My code follows:
TF1 *a=new TF1("a","5.70e-09*pow(x,-2.0)",40,1000);
a->SetLineColor(1);
a->Draw();
TF1 *b=new TF1("b","2.45e-04*pow(x,-3.7)",40,1000);
b->SetLineColor(2);
b->Draw("same");
I get two lines after I set log xy. But how can I get the intersection coordinates of the two lines?
Thanks.
brun
2
Try the following script:
void cross() {
TCanvas *c1 = new TCanvas("c1");
c1->SetLogy();
TF1 *a=new TF1("a","5.70e-09*pow(x,-2.0)",40,1000);
a->SetMinimum(1e-16);
a->SetLineColor(1);
a->Draw();
TF1 *b=new TF1("b","2.45e-04*pow(x,-3.7)",40,1000);
b->SetLineColor(2);
b->Draw("same");
TF1 *c = new TF1("c","abs(a-b)",40,1000);
c->Draw("same");
Double_t xminimum = c->GetMinimumX();
printf("xminimum = %g\n",xminimum);
TArrow *arrow = new TArrow(xminimum,1e-12,xminimum,a->Eval(xminimum),0.05,"|>");
arrow->Draw();
}
This will produce the following output: