This is my Mathematica code,
Get["EDCRGTCcode.m", Path -> {NotebookDirectory[]}]
n = 5;
coord = {t, y1, y2, y3, z};
met = DiagonalMatrix[(L^2 Exp[2 A[z]])/
z^2 {-g[z, B], 1, Exp[B^2 z^2], Exp[B^2 z^2] , 1/g[z, B]}];
RGtensors[met, coord]
A[z_] = -a z^2;
g[z_, B_] =
1 - Integrate[z^3 Exp[-B^2 z^2 - 3 A[z]], {z, 0, z}]/
Integrate[z^3 Exp[-B^2 z^2 - 3 A[z]], {z, 0, zh}];
csq = (-(-gdd[[1, 1]]) gdd[[3, 3]] gdd[[4, 4]]) /. z -> zs;
L = 1; a = 0.15; zh = 1;
t[z1_?NumericQ, z2_?NumericQ, B_, pm_] :=
pm NIntegrate[
Sqrt[ (csq gdd[[5, 5]])/(
gdd[[1, 1]] (gdd[[3, 3]] gdd[[4, 4]] gdd[[1, 1]] - csq))], {z, z2,
zh, z1}, Method -> "LocalAdaptive", Exclusions -> {z - zh == 0}]
plot = Quiet@
ParametricPlot[{{z1, Re[t[z1, 0.2, 0.2, 1]]}, {z1,
Re[t[z1, 0.2, 0.2, -1]]}}, {z1, 1, 2},
PlotStyle -> {Blue, Blue}, PlotRange -> {{0, 2}, {-2, 2}},
AspectRatio -> 1/2];
Show[plot]
The plot is coming up like this.
Though it explicitly depends on $z_2$ and $B$, there is no change in the plot behaviour as I'm changing the $z_2$ and $B$ values.
This is the output for $z_2=0.2$ and $B=0.2$,
In[12]:= Table[{{z1, Re[t[z1, 0.2, 0.2, 1]]}, {z1,
Re[t[z1, 0.2, 0.2, -1]]}}, {z1, 1, 2, 1/4}]
Out[12]= {{{1, 0.}, {1, 0.}}, {{5/4, 0.}, {5/4, 0.}}, {{3/2, 0.}, {3/
2, 0.}}, {{7/4, 0.}, {7/4, 0.}}, {{2, 0.}, {2, 0.}}}
This is the output for $z_2=1.5$ and $B=0.1$,
In[13]:= Table[{{z1, Re[t[z1, 1.5, 0.1, 1]]}, {z1,
Re[t[z1, 1.5, 0.1, -1]]}}, {z1, 1, 2, 1/4}]
Out[13]= {{{1, 0.}, {1, 0.}}, {{5/4, 0.}, {5/4, 0.}}, {{3/2, 0.}, {3/
2, 0.}}, {{7/4, 0.}, {7/4, 0.}}, {{2, 0.}, {2, 0.}}}
Don't know why; all the values are coming 0.
Could anybody help me find where I'm making a mistake, or is there any error in the code?
Plot
doesn't work the first thing I try is replacing that withTable
which will show me some of the values. That usually exposes why it isn't working. Can you edit your post to show the output after replacingParametricPlot[...]
withTable[{{z1,Re[t[z1,0.2,0.2,1]]},{z1,Re[t[z1,0.2,0.2,-1]]}},{z1,1,2,1/4}]
with your current values for za2` andB
and then with the changed values forz2
andB
? If the step size of 1/2 in theTable
doesn't expose the problem then it may need a different step size. $\endgroup$Plot
really is getting zeros. Another editt[z1_?NumericQ,z2_?NumericQ, B_, pm_]:=(Print[pm*Sqrt[(csq gdd[[5,5]])/(gdd[[1,1]](gdd[[3,3]] gdd[[4,4]] gdd[[1,1]]-csq))]];pm NIntegrate[Sqrt[(csq gdd[[5,5]])/(gdd[[1,1]](gdd[[3,3]] gdd[[4,4]]gdd[[1,1]]-csq))],{z,z2,zh,z1},Method->"LocalAdaptive",Exclusions->{z-zh==0}])
to show whatNIntegrate
is really getting. Might tell people where you are getting EDCRGTCcode.m so they think they can trust getting that. Can't tell, don't know, maybe should beA[z_]:=
andg[z_,B_]:=
instead of justA[z_]=
andg[z_,B_]=
$\endgroup$