To see why it does not work, simply put a print statement in your
function "stretched"
to see the values of the arguments . You will see that you try to
evaluate x**0.87 where x is a negative number.
Rene Brun
Roger Mason wrote:
> Hello Rooters,
>
> This macro:
>
> void str(){
> // define stretched exponential
> Double_t stretched(Double_t *x,Double_t *par)
> {
> Double_t fitval = par[0]*TMath::Exp((-x[0]/par[1])**par[2]);
> // Double_t fitval = par[0] + par[1]*x[0];
> return fitval;
> }
>
>
> TCanvas *can = new TCanvas("can","90040 stretched");
>
> TF1 *func = new TF1("func", stretched, 1,300, 3);
> func->SetParameters(184.87,44.69,0.87);
> // func->SetParameters(1,10);
> func->Draw();
>
> can->Update();
> }
>
> generates this:
>
> root [0] .x str.C
> Error: operator '@' or '**' negative operand str.C:3:
>
> with the last line repeated many times.
>
> Can someone explain what I've done wrong?
>
> root 5.14/00 gentoo linux.
>
> Thanks,
>
> Roger
>
Received on Thu Mar 08 2007 - 22:35:22 CET
This archive was generated by hypermail 2.2.0 : Thu Mar 08 2007 - 23:50:01 CET