Mathematica中非线性方程组的求解

时间:2015-02-20 18:24:19

标签: wolfram-mathematica

我试图在数学上用数学方法解决Mathematica中a0-a5的六个方程(g0-g5)的以下系统。我不是Mathematica的专家,我不完全确定如何做到这一点。

f[x_, y_] := Exp[a0 - 1 + a1*x + a2*y + a3*x*x + a4*y*y + a5*x*y]
g0[x_, y_] := Integrate[f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}] - 1
g1[x_, y_] := Integrate[x*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}]
g2[x_, y_] := Integrate[y*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}]
g3[x_, y_] := Integrate[x*x*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}] - 1
g4[x_, y_] := Integrate[y*y*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}] - 1
g5[x_, y_] := Integrate[x*y*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}]
但是,我花了相当多的时间试图让NSolve和FindRoot产生解决方案。这是代码:

NSolve[{g0[x, y]==0, g1[x, y]==0, g2[x, y]==0, g3[x, y]==0, g4[x, y]==0, 
 g5[x, y]==0}, {a0, a1, a2, a3, a4, a5}, Reals]

FindRoot[{g0[x, y]==0, g1[x, y]==0, g2[x, y]==0, g3[x, y]==0, g4[x, y]==0,
g5[x, y]==0}, {{a0,1}, {a1,1}, {a2,1}, {a3,1}, {a4,1}, {a5,1}}]

我可以提供的另一条信息是,f(x,y)的最终解决方案应该等于双变量标准正常密度。任何帮助将非常感激。这是我关于SO的第一篇文章,如果有任何其他信息,请告诉我。

2 个答案:

答案 0 :(得分:1)

我很惊讶。我没想到它会完成。但如果你总是减去积分,那么Reduce就会在眨眼之间完成。

f[x_, y_] := Exp[a0 - 1 + a1*x + a2*y + a3*x*x + a4*y*y + a5*x*y];
g0[x_, y_] := Integrate[f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]-1;
g1[x_, y_] := Integrate[x*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}];
g2[x_, y_] := Integrate[y*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}];
g3[x_, y_] := Integrate[x*x*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]-1;
g4[x_, y_] := Integrate[y*y*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]-1;
g5[x_, y_] := Integrate[x*y*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}];
Reduce[Simplify[{g0[x,y]==0, g1[x,y]==0, g2[x,y]==0, g3[x,y]==0, g4[x,y]==0, g5[x,y]==0},
 Re[4 a4-a5^2/a3]<0], {a0,a1,a2,a3,a4,a5}]

给你

C[1] \[Element] Integers && a0==1+2I\[Pi] C[1]-Log[2]-Log[\[Pi]] &&
   a1==0 && a2==0 && a3== -(1/2) && a4== -(1/2) && a5==0

注意:这给出了一个您应该验证合理的假设。该假设允许它将所有ConditionalExpression转换为可能的问题表达式。我通过查看Integrate返回的每个结果得出了这个假设,并且看到它们都依赖于结果才有效。

答案 1 :(得分:0)

以下是如何用数字表示:

 f[x_, y_, a0_, a1_, a2_, a3_, a4_, a5_] :=
  Exp[a0 - 1 + a1*x + a2*y + a3*x*x + a4*y*y + a5*x*y]
 g0[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
   Integrate[
   f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, Infinity},
      {x, -Infinity, Infinity}] - 1
 g1[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] := 
     Integrate[
     x*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, Infinity},
       {x, -Infinity, Infinity}]
 g2[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] := 
      Integrate[
        y*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity,  Infinity},  
          {x, -Infinity, Infinity}]
 g3[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] := 
      Integrate[
       x*x*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, 
         Infinity}, {x, -Infinity, Infinity}] - 1
 g4[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] := 
        Integrate[
         y*y*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, 
           Infinity}, {x, -Infinity, Infinity}] - 1
 g5[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] := 
      Integrate[
       x*y*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, 
             Infinity}, {x, -Infinity, Infinity}]

 FindRoot[  {
  g0[a0, a1, a2, a3, a4, a5] == 0, 
  g1[a0, a1, a2, a3, a4, a5] == 0,
  g2[a0, a1, a2, a3, a4, a5] == 0,
  g3[a0, a1, a2, a3, a4, a5] == 0,
  g4[a0, a1, a2, a3, a4, a5] == 0,
  g5[a0, a1, a2, a3, a4, a5] == 0}  ,
      {{a0, -.8379}, {a1, 0}, {a2, 0}, {a3, -.501},
       {a4, -.499}, {a5, 0}}]

注意我已经对已知解决方案进行了初步猜测(感谢@Bill),但仍需要很长时间才能找到答案。

  

{a0 - &gt; -0.837388 - 1.4099 * 10 ^ -29我,    a1 - &gt; -6.35273 * 10 ^ -22 + 7.19577 * 10 ^ -46我,    a2 - &gt; -1.27815 * 10 ^ -20 + 6.00264 * 10 ^ -38我,    a3 - &gt; -0.500489 + 1.41128 * 10 ^ -29 I,a4 - &gt; -0.5 - 7.13595 * 10 ^ -44我,    a5 - &gt; -5.55356 * 10 ^ -28 - 9.23563 * 10 ^ -47 I}

 Chop@%
  

{a0 - &gt; -0.837388,a1 - &gt; 0,a2 - &gt; 0,a3 - &gt; -0.500489,a4 - &gt; -0.5,    a5 - &gt; 0}