0
|
5577 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# How to use Module with NSolve?

Posted 11 years ago
 Hi! I want to solve the following  problem. h[x_] := Module[{p, c}, {p, c} /.  Last[NSolve[{e[x] == 0, f[x] == 0}, {p, c}]]]where e and f are nonlinear equations for p and c.When I input h[1], the output shows {p$150234, c$150234} .Is there any mistake in the above usage of Module?
3 Replies
Sort By:
Posted 11 years ago
 Hi,Not sure what you want to use as an argument for h[x_] , but here is an example where x is a parameter for some equation:h[B_] := Module[  {X}, (* LOCALS *)  Evaluate[X /. NSolve[X^2 + B X + 1 == 0, X]]]h[2]I.M.
Posted 11 years ago
 Is there any chance that NSolve isn't finding a solution?In[1]:= Module[{x}, x /. NSolve[x == 4, x]]Out[1]= {4.}In[2]:= Module[{x}, x /. NSolve[x == x + 1, x]]Out[2]= x\$305
Posted 11 years ago
 I see. Thank you!The problem is solved already.
Community posts can be styled and formatted using the Markdown syntax.