# Shifting the plot domain

I integrated this system of two differential equations

b = 0.2001;
k = 8 Pi;
G = 1.5;
Z = 1.1065;
U = 0.478;

s = NDSolve[{Derivative[R][t] == (R[t] Sqrt[k \[Rho][t]])/
Sqrt,
Derivative[\[Rho]][
t] == -((3 G \[Rho][t] Derivative[R][t])/R[t]) +
18 Derivative[R][t]^2 Z \[Rho][t]^(b +
1) (G R[t])/U +
3 Derivative[R][t] Z \[Rho][
t]^b(G R[t]^2)/U Derivative[\[Rho]][t],
R == 100000, \[Rho] == .000001}, {R, \[Rho]}, {t, 0 ,
1000}]


Mathematica finds a singular point when the time t=884.8375974007517. I plotted the solutions starting from this time and I fitted them with a power-law function.

Plot[{Evaluate[{R[t]} /. s],
25000*(t - 884.8375974007517)^((2 b + 1)/3)}, {t,
884.8375974007517, 890}, PlotRange -> All, Frame -> True,
FrameLabel -> {Style["t", Medium], Style["R(t)", Medium]},
GridLines -> Automatic, PlotStyle -> {Black, Red}]

Plot[{Evaluate[{\[Rho][t]} /.
s], ((2 b + 1)^2/(3 K)) (t -
884.8375974007517)^(-2)}, {t, 884.86, 890}, PlotRange -> All,
Frame -> True,
FrameLabel -> {Style["t", Medium], Style["\[Rho](t)", Medium]},
GridLines -> Automatic, PlotStyle -> {Black, Red}]


This is what I get

I would like to make the x-axis starting from t=0 instead of t=884.8375974007517. I think is something related to the plot rather than the integration.

• Plot[{Evaluate[{R[t]} /. s], 25000*(t)^((2 b + 1)/3)}, {t, 0, 6}, PlotRange -> All, Frame -> True, FrameLabel -> {Style["t", Medium], Style["R(t)", Medium]}, GridLines -> Automatic, PlotStyle -> {Black, Red}]? – Feyre Nov 24 '16 at 16:01
• What do you mean by "shift all the x-axis to zero"? Also, please provide s, so that your code can be run by readers. – bbgodfrey Nov 24 '16 at 16:01

You are after FrameTicks:

min = Min@First[s][[1, 2]]["Domain"]


884.838

trans = Table[{min + i, i}, {i, 0, 10}]


{{884.838, 0}, {885.838, 1}, {886.838, 2}, {887.838, 3}, {888.838, 4}, {889.838, 5}, {890.838, 6}, {891.838, 7}, {892.838, 8}, {893.838, 9}, {894.838, 10}}

ticks = {{Automatic, Automatic}, {trans, Automatic}};

Plot[{Evaluate[{R[t]} /. s], 25000*(t - min)^((2 b + 1)/3)}, {t, min,
890}, PlotRange -> All, Frame -> True,
FrameLabel -> {Style["t-" <> ToString[min], Medium],
Style["R(t)", Medium]}, GridLines -> Automatic,
PlotStyle -> {Black, Red}, FrameTicks -> ticks]

Plot[{Evaluate[{ρ[t]} /.
s], ((2 b + 1)^2/(3 k)) (t - min)^(-2)}, {t, min + 0.02, 890},
PlotRange -> All, Frame -> True,
FrameLabel -> {Style["t-" <> ToString[min], Medium],
Style["ρ(t)", Medium]}, GridLines -> Automatic,
PlotStyle -> {Black, Red}, FrameTicks -> ticks]  • This is not according to the label "t". The x-axis should be labeled "$t-884.838$" instead, shouldn't it? – José Antonio Díaz Navas Nov 25 '16 at 19:55