Message Boards Message Boards

0
|
1949 Views
|
10 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to Solve two equations simultaneously?

Posted 1 year ago

Hello,

I'm trying to understand how to use Mathematica better, instead of plugging all of this into excel and using solver. I want to try to find the answers via Mathematica.
I have two equations:

fa = (0.3*100) - x - (x/25)^1.5*exp[14 - 500/T]*50 == 0  
ft = -(100) (16) (T - 350) - (-6000) (30 - x) == 0

    Solve[{fa,ft}, {T,x}] 

did not get the result I needed. The answer for T should be around 453.8 and x = 2.30

The system gives me:

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.

Thank you,

POSTED BY: jason nguyen
10 Replies
Posted 1 year ago

T = 453.826 x = 2.30

is what Excel gave me.

POSTED BY: jason nguyen
Posted 1 year ago

Thank you so much, that was very helpful.

However, my x value is incorrect but the T value is very close.

I'm assuming using solver on excel can get you a wide range of x depending on your initial input.

Thank you guys again. Really appreciated.

POSTED BY: jason nguyen
Posted 1 year ago

Thank you so much, that was very helpful.

However, my x value is incorrect but the T value is very close.

I'm assuming using solver on excel can get you a wide range of x depending on your initial input.

Thank you guys again. Really appreciated.

POSTED BY: jason nguyen

Hi Jason,

What value of x does the Excel solver give?

POSTED BY: Rohit Namjoshi
Posted 1 year ago

T = 453.826 x = 2.30

is what Excel gave me.

Really appreciated for your time.

POSTED BY: jason nguyen

Well, those values do not solve the equations. Both results should be close to zero.

First@fa /. {x -> 2.30, T -> 453.826}
(* -557564. *)

First@ft /. {x -> 2.30, T -> 453.826}
(* 78.4 *)

Most likely the equations you solved in Excel are not the same as the ones in your question. Perhaps a different constant or misplaced parenthesis? Please compare the equations and check that they are correct in the question.

POSTED BY: Rohit Namjoshi
Posted 1 year ago

you are correct, the value 500/T should be 5000/T.

Appreciated, thank you.

POSTED BY: jason nguyen

There is still a discrepancy using 5000/T, Solve gives

{{x -> 0.0823298, T -> 462.191}}
POSTED BY: Rohit Namjoshi

Using Solve

fa = (0.3100) - x - (x/25)^1.5 Exp[14 - 500/T]*50 == 0
ft = -(100) (16) (T - 350) - (-6000) (30 - x) == 0

sol = Solve[{Rationalize@fa, ft}, {x, T}, Reals] // N
(* {{x -> 0.000153337, T -> 462.499}} *)

Verify

First@fa /. sol
(* {-1.52614*10^-11} *)
First@ft /. sol
(* {0.} *)
POSTED BY: Rohit Namjoshi
Posted 1 year ago

Here is one method of finding a solution

sol=NMinimize[Abs[(0.3*100) - x - (x/25)^1.5*Exp[14 - 500/T]*50]+
  Abs[ -(100) (16) (T - 350) - (-6000) (30 - x)],{x,T},Method->"RandomSearch"]

which returns

{0.000541444,{x->0.00323301,T->462.488}}

And I inspect what each of your expressions are with those values

(0.3*100) - x - (x/25)^1.5*Exp[14 - 500/T]*50/.sol[[2]]

which returns

0.0000566773

and

(100) (16) (T - 350) - (-6000) (30 - x)/.sol[[2]]

which returns

0.000484766

Please check that carefully to make certain I haven't made any mistakes.

POSTED BY: Bill Nelson
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