看板 Prob_Solve 關於我們 聯絡資訊
※ 引述《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
chengninghu:非常謝謝喔~我試試看^^ 07/27 14:27
※ 編輯: chungyuandye 來自: 118.232.166.240 (07/30 16:15)