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: How can I change a variable in a equation when use "solve"?
Replies: 1   Last Post: Apr 4, 2013 9:20 PM

Advanced Search

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

Posts: 5,688
Registered: 2/7/05
Re: How can I change a variable in a equation when use "solve"?
Posted: Apr 4, 2013 9:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 4/4/2013 5:17 PM, Jingzhou Wang wrote:
> Dear all,
>
> A question about using the solve function. My code is as follows,
>
> syms a x y
> s = solve('x*exp(x)=y, y=a-x','x,y')
> s = [s.x s.y]
>
> It works when I use a number such as "2" instead of "a" in the equation
>'y=a-x'. But when I include the variable in the equation, it doesn't go.
>Since I want to change the "a" value outside the "solve" function, how can I do this?
>
> The matlab version is R2010a.
>
> Many thanks!
>
> Jing
>


There is no algebraic solution for x

--------------------
EDU>> syms x y a
EDU>> sol=solve(x*exp(x)==a-x,x)
Warning: Explicit solution could not be found.
> In solve at 179
--------------------

when you put a number for 'a', then matlab must have used
numerical root finding to solve it

EDU>> sol=solve(x*exp(x)==2-x,x)
0.6748316143423993509028640916966

I hope you know that not every equation have closed form solution.

--Nasser





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.