我有alpha*xf + beta*xb = xm
形式的等式,其中 xf , xb 和 xm 是来自3个单独列表的值。我想通过获取 xf , xb 的连续值,同时在Mathematica中为 alpha 和 beta 解决它们 XM 。 即,在第一步中我解决了 i 和 i +1 xf , xb的值和 xm ,接下来我解决 i +1和 i xf 的+2值, xb 和 xm 。
答案 0 :(得分:1)
以下是我对他要找的内容的猜测
(*Make up some example data*)
{xflist, xblist, xmlist} = RandomReal[{-3, 3}, {3, 4}];
(*Split each list into {{1,2},{2,3},{3,4}...}*)
xfl = Partition[xflist, 2, 1];
xbl = Partition[xblist, 2, 1];
xml = Partition[xmlist, 2, 1];
(*Solve two equations with two unknowns given six parameters*)
mysolve[{xf1_, xf2_}, {xb1_, xb2_}, {xm1_, xm2_}] := {alpha, beta} /.
Solve[{alpha*xf1+beta*xb1==xm1, alpha*xf2+beta*xb2==xm2}, {alpha,beta}][[1]];
(*Use that to Solve for alpha and beta for all the sets of parameters*)
MapThread[mysolve, {xfl, xbl, xml}]