Re: [問題] 解13條聯立方程式

看板Mathematica作者 (養花種魚數月亮賞星星)時間12年前 (2012/10/12 20:07), 編輯推噓4(401)
留言5則, 2人參與, 最新討論串1/1
※ 引述《hillsand (hillsand)》之銘言: : 大家好: : 請教大家一題13條方程式解13個變數的語法,語法如下: : Solve[{ : RD == (1.1*NR)^0.6, : 0.6*1.1^0.6*NR^-0.4 == wr/em, : wr == em^0.2, : Q == (0.6 NQ^(-1/3) + 0.02 R^(-1/3) + 0.38 K^(-1/3))^-3, : 0.6 (Q/NR)^(4/3) == w, : 0.02 (Q/R)^(4/3) == em, : 0.38 (Q/K)^(4/3) == 0.04, : NR + NQ + NU == 1 - L, : w (NR + NU) == wr*NR, : C1/C2 == 4*em, : L == (1/1.04*0.2^0.2*0.8^0.8*em^-0.2*w)^-0.2, : Q == C1 + 0.25 Q*em^0.5, : 0.25*Q*em^0.5 - em*C2 - em (R - RD) == 0}, : {RD, NR, wr, em, Q, NQ, R, K, w, NU, L, C1, C2}] : Ctrl + Enter後:卻一直在running的狀態,跑了半小時也沒有得出解,因此 : 請教各位高手:我的語法錯誤的地方在那,如何修正才可得到惟一解? : 感謝大家的指教。 eqns = {RD - (1.1*NR)^0.6, 0.6*1.1^0.6*NR^-0.4 - wr/em, wr - em^0.2, Q - (0.6 NQ^(-1/3) + 0.02 R^(-1/3) + 0.38 K^(-1/3))^-3, 0.6 (Q/NR)^(4/3) - w, 0.02 (Q/R)^(4/3) - em, 0.38 (Q/K)^(4/3) - 0.04, NR + NQ + NU - 1 + L, w (NR + NU) - wr*NR, C1/C2 - 4*em, L - (1/1.04*0.2^0.2*0.8^0.8*em^-0.2*w)^-0.2, Q - C1 + 0.25 Q*em^0.5, 0.25*Q*em^0.5 - em*C2 - em (R - RD) - 0} FindRoot[eqn, Transpose@{vars, RandomReal[{0, 50}, Length@vars]}] NMinimize[Flatten@{eqns.eqns, Thread[vars > 0]}, vars, Method -> {"NelderMead", "InitialPoints" -> RandomReal[{0, 50}, {Length@vars+1, Length@vars}]}] {0.608139, {RD -> 0.862636, NR -> 0.349893, wr -> 0.0242465, em -> 0.0245557, Q -> 0.39012, NQ -> 0.117754, R -> 3.42295, K -> 5.00012, w -> 0.710175, NU -> 0.000391739, L -> 0.746915, C1 -> 0.258279, C2 -> 0.625896}} -- 養花種魚數月亮賞星星 http://chungyuandye.twbbs.org -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.233.129.177

10/12 22:09, , 1F
好多語法沒看過,得去查查,有問題再向您請教,感謝您!
10/12 22:09, 1F

10/12 22:54, , 2F
推^^
10/12 22:54, 2F

10/13 11:57, , 3F
請問一下:eqn及vars的定義是什麼?
10/13 11:57, 3F

10/13 11:58, , 4F
FindRoot[eqns,.....] 是否要改成這樣呢?
10/13 11:58, 4F

12/04 17:13, , 5F
感謝戴老師的熱情協助 ^^
12/04 17:13, 5F
文章代碼(AID): #1GU0V_PW (Mathematica)
文章代碼(AID): #1GU0V_PW (Mathematica)