作者chungyuandye (养花种鱼数月亮赏星星)
站内Prob_Solve
标题Re: [问题] mathematic如何取其中之一个解
时间Sun Jul 26 22:55:06 2009
※ 引述《chengninghu (GOGOG)》之铭言:
: 请教大家一下~
: 假设解一个联立方程式
: sollutions=Solve[{fu1,fu2,fu3},{x,y,z}]
: 的解为{x,y,z}->{2,3,4}
: Mathematica会表示成
: {{x->2, y->3, z->4}}
: 可是我想取y值,所以在下方我打了y,发现其实3未存入y中
: 我知道他是将整体解存入sollutions中
: 因此若我想单取出其中一个解,该怎麽做呢??
: 烦请高手解答
: 感激!!
用一个范例说明
sollutions = Solve[{3 x + y == 1, 2 x - 3 y == 2}, {x, y}][[1]]
mathematica的输出是
{x -> 5/11, y -> -(4/11)}
要y的话
y /. sollutions
如果要计算5x-4y的话就
5 x - 4 y /. sollutions
可以查一下mathematica的help, "/." or ReplaceAll
--
养花种鱼数月亮赏星星
http://cydye1069.blogspot.com
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.173.136.169
1F:推 chengninghu:非常谢谢喔~我试试看^^ 07/27 14:27
※ 编辑: chungyuandye 来自: 118.232.166.240 (07/30 16:15)