Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an algorithm that will convert a number nb (n root b) to nc (n root c) whe

ID: 3773711 • Letter: W

Question

Write an algorithm that will convert a number nb (n root b) to nc (n root c) where b, c < 10

Explanation / Answer

// Macro myfunc.C Double_t myfunction(Double_t *x, Double_t *par) { Float_t xx =x[0]; Double_t f = TMath::Abs(par[0]*sin(par[1]*xx)/xx); return f; } void myfunc() { TF1 *f1 = new TF1("myfunc",myfunction,0,10,2); f1->SetParameters(2,1); f1->SetParNames("constant","coefficient"); f1->Draw(); } void myfit() { TH1F *h1=new TH1F("h1","test",100,0,10); h1->FillRandom("myfunc",20000); TF1 *f1=gROOT->GetFunction("myfunc"); f1->SetParameters(800,1); h1->Fit("myfunc"); } class MyFunctionObject { public: // use constructor to customize your function object double operator() (double *x, double *p) { // function implementation using class data members } }; { .... MyFunctionObject * fobj = new MyFunctionObject(....); // create the function object TF1 * f = new TF1("f",fobj,0,1,npar,"MyFunctionObject"); // create TF1 class. ..... } class MyFunction { public: ... double Evaluate() (double *x, double *p) { // function implementation } }; { .... MyFunction * fptr = new MyFunction(....); // create the user function class TF1 * f = new TF1("f",fptr,&MyFunction::Evaluate,0,1,npar,"MyFunction","Evaluate"); // create TF1 class. ..... }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote