Defining a function

Does anyone know how i can define a TF2 object with one variable… but make that variable be equal to something else? cuz we have a long formulate to type in, it would be nice if we could break it up into pieces…

since that wasn’t very clear, let me give a simple example…

say we have

TF1 *func1 = new TF1(“func1”,“cos(x)”,2.1,4.4);

but x is defined outside of this to be say x=((t+1)/2)…

so basically… how do i compose functions? any help would be greatly appreciated!

Thank you!
Christina :smiley:

Hi Christina,

You can just create a many TF1 function as you need:

TF1 *g = new TF1(“g”,"((x+1)/2)",…);
TF1 *func1 = new TF1(“func1”,“cos(g(x))”,2.1,4.4);


Thank you, that was very helpful… except i don’t think it recognizes the g(x)… you have to just put it in there as g