MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: inequality as constraints on NDSolve +Integral...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106451] Re: [mg106196] inequality as constraints on NDSolve +Integral...
  • From: "Stefano Pasetto" <spasetto at ari.uni-heidelberg.de>
  • Date: Wed, 13 Jan 2010 05:57:11 -0500 (EST)
  • References: <201001050642.BAA23770@smc.vnet.net> <4B4356F3.4080201@wolfram.com>

Dear Daniel Lichtblau,
thank you very much, your solution is the most brilliant... but, now,
suppose that I add a perturbation term (I'm not sure about my
implementations)
I define simply a perturbative term for t>0.5 and nothing for t<0.5

f[t_?NumericQ]:=Piecewise[{{Integrate[x[t+a],{a,0,1}],t>0.5},{0,t<=0. 5}}]

so that the system become as you suggested (t interval spans 0->2)
NDSolve[{
x'[t] == UnitStep[x[t]] (-y[t] - x[t]^2 + f[t]),
y'[t] == UnitStep[y[t]] (2 x[t] - y[t]^3 + f[t]),
x[0] == 1, y[0] == 1}, {x, y}, {t, 0, 2}]

where I added the extra f[t]. Apparently it doesn't work. Better: is there
any way to integrate a system like:

NDSolve[{
x'[t] == UnitStep[x[t]] (-y[t] - x[t]^2 + Integrate[x[t+a],{a,0,1}]),
y'[t] == UnitStep[y[t]] (2 x[t] - y[t]^3 + Integrate[x[t+a],{a,0,1}]),
x[0] == 1, y[0] == 1}, {x, y}, {t, 0.5, 2}]

or is it a mission impossible?
thankX again for any help!
Best regards
Stefano



-----Messaggio originale-----
Da: Daniel Lichtblau [mailto:danl at wolfram.com]
Inviato: marted=EC 5 gennaio 2010 16:13
A: Stefano Pasetto
Oggetto: Re: [mg106196] inequality as constraints on NDSolve

Stefano Pasetto wrote:
> Dear Mathematica experts:
>
> is there a possibility to implement a constraint in NDSolve?
>
> Suppose I want to solve
>
> 
>
> NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2 x[t] - y[t]^3,   x[0] == y[0]
> == 1}, {x, y}, {t, 20}]
>
> 
>
> But I want that the solutions satisfied the inequality x[t]>0 for every t
> (because it represent a physical quantity that has no meaning to be
> negative), i.e., and when it becomes =0 it has to stay zero. I've tried
> something like
>
> 
>
> x[t_]:=If[x[t]>0,x[t],0]
>
> 
>
> in the definition of x or y but it does not make sense. Somehow, I'd need
to
> change the solution of the system when the solution itself become
negative.
>
> ThankX for the help, :-)
>
> Best regards
>
> Stefano Pasetto

Could just modify x'[t] so that the derivative is same as before for
x>0, and zero otherwise.

NDSolve[{x'[t] == UnitStep[x[t]]*(-y[t] - x[t]^2),
   y'[t] == 2 x[t] - y[t]^3, x[0] == y[0] == 1}, {x, y}, {t, 20}]

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: Radicals simplify
  • Next by Date: Re: More /.{I->-1} craziness
  • Previous by thread: inequality as constraints on NDSolve
  • Next by thread: Re: inequality as constraints on NDSolve +Integral...