Another question on Solver

Another question on Solver - Сообщения

#1 Опубликовано: 17.08.2012 12:20:02
nmvrolijk

nmvrolijk

0 сообщений из 2 понравились пользователям.

Группа: User

Hi,

I'm new to SMath but familiar with MathCAD. I'm used to solving systems of equations using "Solve" and "Find" in MathCAD and wondering how to do the same thing in SMath. So far I haven't seen any posts addressing this specifically. The mass balance I'm currently playing around with is displayed below trying to solve for D & E. Any help is appreciated. Thank you.

F:=175000

F.ia:0.15
D.ia:=0.9034
E.ia:=0.0005

F:=(D*D.ia+E*E.ia)/F.ia

res:=solve(F=D+E,D) <-- Boolean Equals
#2 Опубликовано: 17.08.2012 15:10:32
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello,

It seems you've been missing variable "E". Define it before the solve() and see what will be the result.

Regards,
Radovan


[MATH=eng]F:175000[/MATH]

[MATH=eng]F.ia:0.15[/MATH]

[MATH=eng]D.ia:0.9034[/MATH]

[MATH=eng]E.ia:0.0005[/MATH]

[MATH=eng]F:{D*D.ia+E*E.ia}/F.ia[/MATH]

[MATH=eng]E:1[/MATH] //this was missing

[MATH=eng]res:solve(F≡D+E,D)[/MATH]

[MATH=eng]res=0.1984[/MATH]


P.S. Search the Forum and Wiki for solve() and roots() functions
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Опубликовано: 20.08.2012 10:35:31
nmvrolijk

nmvrolijk

0 сообщений из 2 понравились пользователям.

Группа: User

Radovan,

Thank you for a quick response. However, what I'm looking to do is solve a system of two equations for two variables:

F=(D*D.ia+E*E.ia)/F.ia
&
F=D+E

As long as everything but D&E is defined, D&E can be solved for.

Is there a command in SMath to solve x equations simultaneously for x variables? Thank you again for your help.
#4 Опубликовано: 20.08.2012 12:32:28
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello,

For the system of equations you can try roots()


[MATH=eng]roots(mat(F-{D*D.ia+E*E.ia}/F.ia,F-D-E,2,1),mat(D,E,2,1))=mat(28976.0771,1.4602*10^5,2,1)[/MATH]


If fails, try with guess values
Guess values:


[MATH=eng]D0:1[/MATH]
[MATH=eng]E0:1[/MATH]


[MATH=eng]res:roots(mat(F-{D*D.ia+E*E.ia}/F.ia,F-D-E,2,1),mat(D,E,2,1),mat(D0,E0,2,1))[/MATH]


[MATH=eng]res=mat(28976.0771,1.4602*10^5,2,1)[/MATH]


Checking


[MATH=eng]mat(F-{el(res,1)*D.ia+el(res,2)*E.ia}/F.ia,F-el(res,1)-el(res,2),2,1)=mat(0,-5.0331648*10^{-10},2,1)[/MATH]

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений