MathGroup Archive 2010

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

Search the Archive

Re: inequality as constraints on NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106255] Re: inequality as constraints on NDSolve
  • From: dh <dh at metrohm.com>
  • Date: Wed, 6 Jan 2010 06:00:51 -0500 (EST)
  • References: <hhun01$n66$1@smc.vnet.net>


Hi Stefano,

I think you are attacking your problem the wrong way. If the DE says 

that the solution becomes negative then you can not simply request that 

is is zero. In your case, the model does obviously not mirror the 

physical system.

Now, if you can live with the imperfection of you model, you may simply 

force the solution not to be nagative by taking the Max[0, solution].

But it will be better if you look for a better model that suits the 

physical system.

Daniel



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

> 




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