# Question:changing values of parameters within dsolve

## Question:changing values of parameters within dsolve

Maple

Dear all,

I'm trying to solve a system of two differential equations which depend on two parameters, which I call "K" and "polytrope" in my worksheet. The two differential equations are for the density rho(r) of the star and it's mass m(r). What I'm trying to do with dsovle is to change the values of K and polytrope once rho(r) drops below a certain value and letting dsolve continue the integration with the new values for the parameters. I was thinking about using events, but I'm not sure how to do it, since Maple doesn't seem to allow the use of "<" and ">" in the trigger of an action and I'm not sure how to let dsolve distinguish between the cases rho(r)<rho_crit and rho(r)>=rho_crit.

 > restart;
 >
 > polytrope1:=4./3;
 (1)
 > polytrope2:=2.;
 (2)
 > K2:=10^12;
 (3)
 > rho_crit:=4.*10^(-14);
 (4)
 > K1:=K2*rho_crit^(polytrope2-polytrope1);
 (5)
 > odes := diff(rho(r), r) = -(rho(r)*(1+K*rho(r)^(polytrope-1)/(polytrope-1))+K*rho(r)^polytrope)*(4*Pi*r^3*K*rho(r)^polytrope+m(r))/(K*polytrope*rho(r)^(polytrope-1)*r*(r-2*m(r))), diff(m(r), r) = 4*Pi*rho(r)*(1+K*rho(r)^(polytrope-1)/(polytrope-1))*r^2;
 (6)
 > r0:=10.^(-10);
 (7)
 > ics:=rho(r0)=10.^(-13),m(r0)=0;
 (8)
 > TOV:=dsolve({odes,ics},numeric,parameters=[K,polytrope]);
 (9)
 >

﻿