0
$\begingroup$
int[r_]=-((557.310989080004 r)/((37.3042 - r) (-25.578 + r) (62.8822 + 
r) Sqrt[0.0345106153943703 - ((37.3042 - r) (-25.578 + 
  r) (62.8822 + r))/(3000 r)]))

This is the function of r , now next is that I want to solve the differential equation using this function. Before that at my boundary conditions, this whole function vanishes as;

int[maxr]=1/0
int[rg]=1/0

maxr=31.0723250284387 and rg=25.57799942210616`

Next I try to solve the following differential equation via NDsolve

sol = NDSolve[{TD'[r] == int[r], TD[maxr] == Infinity}, {TD}, {r,maxr, rg}, Method->"ExplicitRungeKutta"]

But it fails are throws some errors like Solve::infc: The system TD==[Infinity] contains an infinite object [Infinity]. NDSolve::icfail: Unable to find initial conditions that satisfy the residual function within specified tolerances. Try giving initial conditions for both values and derivatives of the functions. Can anyone help me out.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

The solution to the ODE is infinity.

You can see this by solving analytically

ClearAll[r, TD, k];
intr = -((557.310989080004 r)/((37.3042 - r) (-25.578 + r) (62.8822 + 
         r) Sqrt[0.0345106153943703 - ((37.3042 - r) (-25.578 + 
              r) (62.8822 + r))/(3000 r)]));
intr = SetPrecision[intr, Infinity];
maxr = SetPrecision[31.0723250284387, Infinity];
rg = SetPrecision[25.57799942210616, Infinity];
sol = TD[r] /. First@DSolve[{TD'[r] == intr}, TD[r], r];

Now set up an equation to solve for constant of integration

eq = (sol /. r -> maxr) == k;
constant = C[1] /. First@N@Solve[eq, C[1]];

Replace the constant found back in the solution

sol = sol /. C[1] -> constant;

Now let k go to infinity, which maps to BC condition that TD[maxr] == Infinity

Limit[sol, k -> Infinity]

Mathematica graphics

This means the solution is

$$ TD(r)=\infty $$

You probably want to check you BC are correct.

$\endgroup$
2
  • $\begingroup$ Thanks for clarfication. But finally i want to plot TD[r], from maxr to rg . Which should be diverging at maxr and rg. How can that be done $\endgroup$
    – Immy Salam
    Apr 26, 2021 at 13:10
  • $\begingroup$ @ImmySalam Plot the result of NDSolve[{TD'[r] == int[r], TD[28] == 0}, TD[r], {r, 25, 32}], which goes to Infinity at rg and -Infinity at rmax. Changing the value of TD[28] simply moves the whole curve up or down but does not change its shape. $\endgroup$
    – bbgodfrey
    Apr 26, 2021 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.