[ROOT] What's that? pow(x, -2.2) in Log-Log-Plot...
From: Thomas Bretz (tbretz@astro.uni-wuerzburg.de)
Date: Wed Apr 24 2002 - 13:07:47 MEST
Hi all,
I'm trying to make a very simple log-log-plot of a very very simple
function... BUT...it doesn't appear as a line... (I'm using root 3.02/07
on Linux kernel 2.4.6) I attach a plot how it looks like... It is
neither working as macro nor with Aclic. I tried also an interpreted
function
TF f("pow(x, -2.2)", ...)
this seems to work fine.
--------- macro: test.C ----------
Double_t lumifunc(Double_t *x, Double_t *k=NULL)
{
Double_t N0=1.0;
return pow(x[0], -2.2);
}
void test()
{
TF1 func1("LF", lumifunc, 0.001, 1, 0);
func1.Clone()->Draw();
gPad->SetLogx();
gPad->SetLogy();
}
-----------------------------------
Can I do something wrong here?
Best regards,
Thomas.
- application/postscript attachment: c1.ps
#include <TF1.h>
Double_t lumifunc(Double_t *x, Double_t *k=NULL)
{
Double_t N0=1.0;
return pow(x[0], -2.2);
}
/*
Double_t spectrum(Double_t *x, Double_t *k=NULL)
{
Double_t A0=1.37e-10;
Double_t alpha=-2;
return A0*pow(x[0], alpha);
} */
Double_t Eofz(Double_t *x, Double_t *k=NULL)
{
Double_t o=0.3; //Omega
Double_t r=0.0; //Omega_R
Double_t l=0.7; //Omega_L
Double_t zplus1=x[0]+1;
return 1./sqrt((o*zplus1+r)*zplus1*zplus1+l);
}
Double_t dl(Double_t *x, Double_t *k=NULL)
{
Double_t H0=65;
Double_t c=2.99e-8;
TF1 func1("Eofz", Eofz, 0., 6, 0);
Double_t integ=func1.Integral(0, x[0], NULL);
return integ*c/H0;
}
Double_t flux(Double_t *x, Double_t *k)
{
Double_t z=k[0];
Double_t beta=1.1;
Double_t d=dl(&z);
if(d==0) return 0;
return x[0]*pow(z+1, 1.-beta) / (TMath::Pi()*4) / (d*d);
}
Double_t mult(Double_t *x, Double_t *k)
{
Double_t L = x[0];
Double_t z = k[0];
return lumifunc(&L) * flux(&L,&z);
}
void haupt()
{
TF1 func1("LF", lumifunc, 0.001, 1, 1);
func1.SetParameter(0, 0.03);
func1.Clone()->Draw();
gPad->SetLogx();
gPad->SetLogy();
//TF1 t("name", "LF*sp", 0.001, 1);
// t.Clone()->Draw();
}
This archive was generated by hypermail 2b29
: Sat Jan 04 2003 - 23:50:51 MET