Message Boards Message Boards

GROUPS:

Avoid error when using piecewise function in NDSolve?

Posted 7 months ago
756 Views
|
2 Replies
|
0 Total Likes
|

I am trying to use piecewise function in NDSolve

I also have notebook attached.

but get error message that follows:

enter image description here

Any idea why? I tried the residue method as specified in warning, but did not get results that make sense. Help is greatly appreciated!!!

Attachments:
2 Replies

Hi

Your M[r] function is constantly growing, so it does not have a maximum.

Regards, MI.

Attachments:

With a few PiecewiseExpand it gives a solution:

Pf[r_, \[Rho]_] := 
  Piecewise[{{K*(\[Rho][r])^(
      5/3), \[Rho][
       r] < \[Rho]low}, {(\[Rho]high*c^2 - 
        K*\[Rho]low^(5/3))/(\[Rho]high - \[Rho]low)*\[Rho][
       r], \[Rho]low <= \[Rho][r] <= \[Rho]high}, {\[Rho][r]*
      c^2, \[Rho][r] > \[Rho]high}}];
MassEqf = (M'[r] == 4 \[Pi] *\[Rho][r]* r^2);
PressureEqf = (\[Rho]'[r] PiecewiseExpand[
      D[Pf[r, \[Rho]], r]/\[Rho]'[r]] == 
    PiecewiseExpand[-((
      G*(M[r] + 4 \[Pi]*r^3*Pf[r, \[Rho]]/c^2)*(\[Rho][r] + 
         Pf[r, \[Rho]]/c^2))/(r^2*(1 - 2*G*M[r]/(r*c^2))))]);
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract