1
$\begingroup$

I want to use this code for the backward Numerical solution but patently not well defined?

Clear["Global`*"]
f = 0.7; γ = 1;
NDSolve[{s''[x]/s[x] + ((3 γ)/2 - 1) (s'[x]/s[x])^2 - (3 γ*f)/2 == 0, s[1] == 1, s'[1 - 100 $MachineEpsilon] == 1, s[1 - 100 $MachineEpsilon] == 1}, s, {x, 0, 1 - 100 $MachineEpsilon},
  Method -> {"Shooting", "StartingInitialConditions" -> {s[1] == 1, s'[1] == 1}}];
ListLinePlot[s /. %]
$\endgroup$
1
  • 3
    $\begingroup$ First of all, why not address the error. "Overdetermined" is pretty clear: remove a boundary condition. That the error is not mentioned is confusing: Do you really think it should be ignored? Second, why are the boundaries so close? Are you trying to approximate some limit? I would think it would force relatively large rounding errors in $\Delta x$ in the step computations. $\endgroup$ Commented Jun 21, 2024 at 16:09

2 Answers 2

2
$\begingroup$

Given that the problem is undefined at present, this is more of a comment to show what is going on near the boundary conditions $s(t_0)=s'(t_0)=1$ (shown as a magenta dot). This might help in clarifying the problem.

delta = 5/4;
{s0, r0} = {1/2, 1/2};
StreamPlot[
 Echo@First[
    SolveValues[{ode /. v_[x] :> v, r' == s'', r == s'}, {s', 
      r'}, {s''}]] // Evaluate
 , {s, s0 - delta, s0 + delta}, {r, r0 - delta, r0 + delta}
 , Epilog -> {Magenta, PointSize@Large, Point[{1, 1}]},
 FrameLabel -> {s[x], s'[x]}]

enter image description here

It seems clear from the plot that the three (!) boundary conditions, {s[1] == 1, s'[1 - 100 $MachineEpsilon] == 1, s[1 - 100 $MachineEpsilon] == 1} cannot be satisfied, since the vertical line s == 1 is crossed only once by the trajectory through the magenta dot.

$\endgroup$
0
$\begingroup$

Your system might be solved analytically, but the boundary conditions cann't be fullfilled

f = 7/10; γ = 1;

S = DSolveValue[s''[x]/s[x] + ((3  γ)/2 -1) (s'[x]/s[x])^2 - (3γ   f)/2 == 0,   s, x ]

Solve[{S[1] == 1, S'[1] == 1}, {C[1], C[2]}, Reals]
(* {} *) 
$\endgroup$
3
  • 1
    $\begingroup$ But V 14 gives analytical solution with the BC? It gives warning messages but still solve it. Screen shot i.sstatic.net/fIPltM6t.png I remember you said before you using older version of Mathematica? $\endgroup$ Commented Jun 21, 2024 at 12:11
  • 1
    $\begingroup$ I know it has analytical solution I just wanted to check the numerical solution in backward method! $\endgroup$ Commented Jun 21, 2024 at 15:05
  • $\begingroup$ @Nasser Interesting: v14 finds a solution, v12.2 doesn't $\endgroup$ Commented Jun 23, 2024 at 8:53

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.