Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Integration with variable limits
Replies: 17   Last Post: Aug 20, 2013 10:20 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten

Posts: 1,470
Registered: 11/8/10
Re: Integration with variable limits
Posted: Aug 20, 2013 10:20 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Sanaa" wrote in message <kulm7s$kes$1@newscl01ah.mathworks.com>...
> "Torsten" wrote in message <kulcpv$jj9$1@newscl01ah.mathworks.com>...
> > "Sanaa" wrote in message <kulb7b$qrm$1@newscl01ah.mathworks.com>...
> > > "Torsten" wrote in message <kul93r$t5q$1@newscl01ah.mathworks.com>...
> > > > "Sanaa" wrote in message <kul7kv$a10$1@newscl01ah.mathworks.com>...
> > > > >
> > > > > > > y_(n+1)=x_n;
> > > > > > > x_(n+1)= x_n + integration (f(y_(n+1)(s))) ds.

> > > > > >
> > > > > > So your final aim is to solve the delay differential equation
> > > > > > dx(t)/dt = rho*x(t-r)*(1-x(t-r))
> > > > > > with x given on an interval of length r at the beginning, r and rho constant over time ?
> > > > > >
> > > > > > Best wishes
> > > > > > Torsten.

> > > > >
> > > > > No. I don't want to solve the original delay differential equations, I wish to solve the discrete system after a certain discretization method applied to it.
> > > > > Thanks a lot in advance.

> > > >
> > > > But if the discretrization method is given, you are also given how the above integral is approximated.
> > > > Or are you _searching_ for an adequate discretization method for the delay differential equation ?
> > > >
> > > > Best wishes
> > > > Torsten.

> > >
> > > Thanks once again for your kind reply. The discretization method here is very simple, the step methods, I am not searching for the method, i just don't know how to approximate the integral. I have read about trapz and cumtrapz but my only problem now is the variable limits of integration. Using trapz or cumptrapz don't allow me to specify the variable limits; I am really confused.

> >
> > First take care that your step length divides r - otherwise you will have trouble.
> > Say you have the delay differential equation from above
> > dx/dt = rho*x(t-r)*(1-x(t-r))
> > with x given on the interval [-r,0].
> > Now take a step dt such that dt divides r (say n*dt=r)
> > x(t+dt)-x(t) = integral_{t'=t}^{t'=t+dt} (rho*x(t'-r)*(1-x(t'-r)) dt')
> > The integral can be approximated by the trapezoidal rule:
> > integral_{t'=t}^{t'=t+dt} (rho*x(t'-r)*(1-x(t'-r)) dt') ~
> > dt*(rho*x(t+dt-r)*(1-x(t+dt-r))+rho*x(t-r)*(1-x(t-r)))/2.
> > Thus your recursion reads
> > x(t+dt)=x(t)+dt/2*rho*(x(t+dt-r)*(1-x(t+dt-r))+x(t-r)*(1-x(t-r)))
> > Inserting n*dt=r gives
> > x(t+dt)=x(t)+dt/2*rho*(x(t-(n-1)*dt)*(1-x(t-(n-1)*dt))+x(t-n*dt)*(1-x(t-n*dt)))
> > or as discrete recursion
> > x_(k+1)=x_k+dt/2*rho*(x_(k-(n-1))*(1-x_(k-(n-1)))+x_(k-n)*(1-x_(k-n)))
> > for k=0,1,2,...
> > The values x(-(n-1)),x(-(n-2)),...,x(0) are given by the initial condition on the interval
> > [-r,0].
> > Does this help ?
> >
> > Best wishes
> > Torsten.

>
> I am sorry for any inconvenience. I want the symbolic integration of the function (whatever the original problem is and whatever the dis. method is); that is,
> y_(n+1)=x_n;
> x_(n+1)= x_n + integration (f(y_(n+1)(s))) ds.
> where f(y(t)) = rho*y(t)*(1-y(t)).
> From the discussion above, I think this task is very difficult.
> Anyway, thank you very much for your help.


Let's forget about delay differential equations for a moment and say you want
to solve the differential equation
y'(t)=f(t,y(t))
y(t0)=y0.
Say you have the solution at times t0 < t1 < t2 < ... < tn
and you want to integrate up to tn+dt.
Then you integrate both sides of
y'(t)=f(t,y(t))
in the limits from tn to tn+dt and get
y(tn+dt)-y(tn) = integral_{t'=tn}^{t'=tn+dt} f(t',y(t')) dt'.
Since you only know approximations for y in discrete points t0,t1,...,tn,
you can't use "int" or any symbolic integrator to integrate the right-hand side.
But there are methods which use the known discrete values (t0,y(t0)),...,(tn,y(tn))
to approximate the integral.
The simplest of these is to replace f(t,y(t)) on the interval [tn;tn+dt] by a constant
function:
f(t,y(t))=f(tn,y(tn)) for all t in [tn;tn+dt] or
f(t,y(t))=f(tn+dt,y(tn+dt)) for all t in [tn;tn+dt].
From the first approximation, the resulting method is the explicit Euler-method,
from the second approximatio, the resuting method is the implicit Euler method.
Or you can approximate the integral by a linear function ; this results in the
trapezoidal rule:
f(t,y(t))=f(tn,y(tn))+(t-tn)/dt*(f(tn+dt,y(tn+dt))-f(tn,y(tn))).
That's the rule I suggested above.
So there is no way in your case to "integate the function symbolically" since you don't know an explicit expression for the function. You have to work with the discrete known function values (t0,y(t0)),...,(tn,y(tn)) and find an approximation for the integral from these discrete values.

Best wishes
Torsten.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.