Message Boards Message Boards

0
|
4442 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Solve the following equation?

Posted 6 years ago

I'm a beginner to Mathematica. I had the following code:

Solve[-0.45 - 8./(1 + 3 E^(-x/30)) + (80 E^(-x/30) (0.65 - 0.01 x))/(1 + 3 E^(-x/30))^2==0,x]

This error appeared:

"Solve::inex: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help."

I suppose it is because E is inexact. How would I go about solving this equation then?

POSTED BY: Sabrina Lau
3 Replies

E is exact. But .45 is not exact, it is a decimal approximation. One might instead use 9/20.

POSTED BY: Daniel Lichtblau
 eq = -0.45 - 8./(1 + 3 E^(-x/30)) + (80 E^(-x/30) (0.65 - 0.01 x))/(1 + 3 E^(-x/30))^2;
 Solve[Rationalize[eq, 0] == 0, x, Reals]

 (*  {{x -> Root[{81 + 169 E^(#1/15) + 
        E^(#1/30) (-506 + 16 #1) &, -96.939605776733132399}]}, {x -> 
    Root[{81 + 169 E^(#1/15) + E^(#1/30) (-506 + 16 #1) &, 
      12.3348914426321591897}]}} *)

 NSolve[eq == 0, x, Reals]

 {{x -> -96.9396}, {x -> 12.3349}}

Or use FindRoot.

 {FindRoot[eq, {x, 10}],FindRoot[eq, {x, -90}]}

  (* {{x -> 12.3349}, {x -> -96.9396}} *)
POSTED BY: Mariusz Iwaniuk

For trascendental equations it is useful to give a bounded interval where to search, for example:

Solve[-0.45 - 8./(1 + 3 E^(-x/30)) +
    (80 E^(-x/30) (0.65 - 0.01 x))/(1 + 3 E^(-x/30))^2 == 0 &&

  0 < x < 20,
 x]

I chose the interval 0 < x < 20 after plotting the function.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract