Hi. What do I have to type on the Root command line (after opening root.exe) to solve / evaluate a one dimensional integral / derivative?. Thanks
ROOT Version: 5.34.25
Platform:
Compiler:
Hi. What do I have to type on the Root command line (after opening root.exe) to solve / evaluate a one dimensional integral / derivative?. Thanks
ROOT Version: 5.34.25
Platform:
Compiler:
In general, to see what ROOT can/cannot do, and more info, scroll to the top of the Forum pages, click on “Home” and then on “Learn”, where you will find links to the beginner’s guide, manual, tutorials, etc.
If you go to the Beginner’s Guide (“ROOT Primer”) and search for integration, you’ll find something in the “ROOT as function plotter” section; follow the link to TF1 that’s there to go to the TF1 documentation; there, search for integration or differentiation, and see if any of the methods is what you want.
Hi,
first, you need to define a function you want to integrate. Let it be y=x defined in the range from x=0 to x=10:
TF1 f1 {"f1", "x", 0, 10};
Second, you integrate it (e.g., from x=0 to x=1) and print the result out:
printf("Integral of f1 from 0 to 1 is %.2f\n", f1.Integral(0, 1));
That’s it, just two lines of code in the ROOT CLI!
Ok, thanks for all the information. It has been helpful. I could only integrate, I couldn´t derive; So, What do I need to type on the Root command line to derive?. I typed f1→Derivative(x) on the Root command line, but the “error: Symbol x is not defined in current scope” appeared. f1 is the function y=x, defined from x=0 to x=10.
Hi, I did what you told and Root correctly calculated the integral; thanks for your help