Re: Solving simple equations
- To: mathgroup at smc.vnet.net
- Subject: [mg83225] Re: Solving simple equations
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Thu, 15 Nov 2007 05:42:43 -0500 (EST)
On 11/14/07 at 4:51 AM, hredlich at gmx.net (Holger) wrote: >I'm trying to solve these two simple equations but it doesn't work. > >meqn = { x'[t]==beta(x[t]+(Subscript[P,f]-p[t])), >p'[t]==(Tanh[Subscript[a,1](x[t]+(Subscript[P,f]-p[t]))+ >Subscript[a,2]x[t]]-x[t]) >}; >eqp = NSolve[ meqn/.{ p'[t]->0,x'[t]->0},{p[t], x[t] >} >] >I guess I'm doing a mistake somewhere. Does anyone have idea where >the mistake is? You are trying to get NSolve to do something it simply isn't intended to do. NSolve is intended to provide a numerical solution to a set of polynomial equations. Your equations cannot be reduced to polynomials and you've not given numeric values to all of the coefficients. You can solve things with Mathematica as follows: =46irst, lets simplify things a bit by getting rid of the unneeded variable t, i.e. (This needs to be done if you are going to get a numeric solution) In[5]:= meqn /. {p'[t] -> 0, x'[t] -> 0, p[t] -> p, x[t] -> x} Out[5]= {0 == beta*(-p + x + Subscript[P, f]), 0 == Tanh[x*Subscript[a, 2] + Subscript[a, 1]* (-p + x + Subscript[P, f])] - x} Now the first equation can easily be solved for p In[6]:= Solve[First[%], p] Out[6]= {{p -> x + Subscript[P, f]}} putting this solution into the second equation gives In[7]:= Last[%%] /. First[%] Out[7]= 0 == Tanh[x*Subscript[a, 2]] - x Now once Subscript[a, 2] is replaced with a specific numeric value, FindRoot can be used to find a numeric solution for x. That can then be substituted into the solution to the first equation to get p. -- To reply via email subtract one hundred and four