Round-off and simple triggers...

Can anyone explain me how to use the next feature that you can find in ?dsolve,numeric,events,Round-off and simple triggers or refer me to a previous answer that explain this:

This is primarily desired to be able to apply events for an ODE system that has been separated into disjoint cases dependent on the values of particular triggers (in which case you always want to use a form that provides the values just past the trigger point).

Specially how to separate the ODE system into disjoint cases. Thanks in advanced.

changing values of parameters within dsolve...

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)
 >

obtaining the maximum value of a variable after us...

Dear all,

I have a question regarding the dsolve procedure in Maple. I'm trying to construct a neutron star model using the Tolman-Oppenheimer-Volkoff equation using a polytropic equation of state (EOS) which requires me to solve the ode system:

diff(rho(r),r)=-(rho(r)*(1+K/(5/3-1)*rho(r)^(5/3-1))+K*rho(r)^(5/3))*(4*Pi*r^3*K*rho(r)^(5/3)+m(r))/(K*5/3*rho(r)^(5/3-1)*r*(r-2*m(r)))

diff(m(r),r)=4*Pi*rho(r)*(1+K/(5/3-1)*rho(r)^(5/3-1)

where I have used the EOS P(r)=K*rho(r)^(5/3) and K is a known constant. rho is the density of the star, m it's mass and P the pressure inside the star.

For the initial conditions I have chosen: rho(10^(-10))=rho_0 and m(10^-10)=0. I have chosen r=10^-10 as the innermost point for the integration, since the differential equation for rho is singular at r=0. rho_0 is the central density of the star.

I solve these equations numerically using:

TOV:=dsolve({ode,ics},numeric,output=listprocedure)

where ode is my system of differential equations and ics are my initial conditions. I need now the radius of the star (R_star), which is the maximum value of r, up until which Maple has carried out the integration.

My problem is, I don't know of any efficient way, to do this. What I'm doing currently is defining a procedure TOVr:=rhs(TOV[1]) and I evaluate it at a very high value of r, for which Maple returns me the error message: "Error, (in TOVr) cannot evaluate the solution further right of ..., probably a singularity". I then use the command TOVr('last') to call the maximum value of r and to store it.

I can use the above method, as long as I'm solving the ODEs only for a few different values of rho_0. But I would like to plot m(R_star) for values of rho_0 ranging from 10^(-14) to 10^(-12) in order to find the value of rho_0, for which I can obtain the maximum value for m(R_star). But this requires me to know the value of R_star for every rho_0 and using the above method is not feasible for say hundred different values of rho_0, since I can't write a loop, because it get's terminated as soon as Maple gives me the first error message.

I was thinking of using perhaps the 'events' command in dsolve, to stop the numeric integration once the value for the pressure drops very low, say below 10^(-46), since the radius at which P(r)=0 defines the stellar surface. I tried using:

TOV:=dsolve({ode,ics},numeric, events=[[K*rho(r)^(5/3)-10^(-46),halt]])

but if I try again to evaluate the solution at a large value of r, I get the above error message, and the integration doesn't get canceled, although the value 10^(-46) is bigger than the value for the pressure I would obtain for R_star using TOVr('last') and Maple shouldn't encounter a singularity.

Am I using the 'events' command wrong? And does somebody know of a more efficient method to obtain the maximum value of a variable after carying out a numerical integration using dsolve?

Sorry for the long post and thank you all.

10 000 000

Maple

Event?

January 2014: Pages of oldest Russian Maple Application Center have been opened 10000000 times.

http://webmath.exponenta.ru/

Events in dsolve...

Hi

I  have a system of second order differential equation to be solved numerically. I would like to set up events to halt integration  to find the values of phi when r(phi)=2/3 . Here is my code

DE:=diff(1/r(phi),phi,phi)+(1/r(phi))=(G*M/h^2)+(3*G*M/c^2*r(phi)^2));

ics:=r(0)=2/3,D(r)(0)=0;G:=1;M:=1;h:=1;c:=1;

p:=dsolve({DE,ics},numeric,events=[[r(phi),r(phi),halt]],[diff(r(phi),phi)=0,halt]]);

The code only works for the second event so it halts for r(phi)=1.63... etc

How do i stop this?

Thanks for any help.

How to use events command in dsolve/numeric for di...

My problem is How to use events command in dsolve/numeric for different points of independent variable?                                     A simple example:

de:=diff(x(t),t)=-x(t);

ds:=dsolve({de,x(0)=1}, numeric, method = rkf45,abserr=1E-12,relerr=1E-11,events =[[x(t)-1E-8,halt]]);

works perfectly, but I need to compare x(t) and x(t-h) in two consecutive...

ODE with events...

HI,is it possible to solve the ODE system (that I have uploaded) by adding events at a certain timestep, instead of reformulating the system for each step.The ODE system expresses two coupled movements y(t) and X(t). The current position of y(t) is controlled by a parameter which depends on values calculated in the previous step, while changing the sign for each step.Thank you!

Hi! I have the same problem....

Hi!

I have the same problem.

```   "Simulation problem: maximum number of event iterations reached (100) at t= ...."
```

I have a model which worked without problem in maplesim2, using a lot of event iterations. The model can only work this way, becouse its a mechanic model where the friction is function of the sliding speed, thus where the speed changes value, the friction coefficient does also, and an event occurs.

I really need to know where...

What are events?...

What is meant by events? I have seen this error numerous times.

```   "Simulation problem: maximum number of event iterations reached (100) at t= ...."
```

How do I model so that I can avoid them?

dsolve, events, how to control for a sign change...

I have a system of 3 ODEs in 3 variables x(t),y(t),z(t) to be solved numerically. I would like to set up events to halt integration as soon as one of the derivatives changes sign.

I've tried things like:

'events' = [ [ diff(x(t),t) >0, 'halt'] ] :

'events' = [ [ diff(x(t),t) = 0 .. 0.1, 'halt'] ] :

I might have tried something like increasing(x(t)) (how nice and intuitive), but if I understand correctly the help page on this, increasing(x(t)...

dsolve event handling question, general...

dsolve event handling looks like a great tool, but I can't understand how it works and it's not sufficiently popular to google my way to examples online. There are two things I'd like to do: 1) interrupt the computation once some variable leaves a certain range, 2) interrupt the computation if the solver gets stuck into an infinite loop. Both are documented in the help, but I don't understand it. Suggestions welcome, thanks!

http://www.maplesoft.com/support/help/Maple/view...

Program upgrade, model not working anymore...

Hello!

I made an upgrade from Maple 13 to 14, but a program i wrote with maple 13 (ode event handling) simply is incorrect in maple 14. The events aren't recognized anymore. What is the problem?

Thank You.

ODE Event handling...

Hi!

I i have a 2nd order ODE where i want to chance the derivatives of x(t) and y(t) exactly at sqrt(x(t)^2+y(t)^2)=1 ,or before, as close to 1 as possible.

I found "event=" in/dsolve/numeric/events, where i can define the trigger and the action.

What is the difference between: "event=[[sqrt(...)-1,diff(x(t),t)=...],[sqrt(...)-1,diff(y(t),t)=...]]" and "event=[[sqrt(...)-1,[diff(x(t),t)=...,diff(y(t),t)=...]]]", because i get different results, which one is the correct form?

Raptor Math

by: Maple

This describes in more detail (with permission and citation) the method posted here of solving problem 2 in the XKCD comic Substitute.