matlab 合并两个方程
来源:学生作业帮 编辑:大师作文网作业帮 分类:数学作业 时间:2024/11/11 08:00:06
matlab 合并两个方程
a,x,g,r都是参数
第一个方程 2ax/(1+x^2)+2g=1
第二个方程 a/(1+x^2)+r-2g(x-r)=x
我要两个方程合并消去a,变成x=?这样的式子,
a,x,g,r都是参数
第一个方程 2ax/(1+x^2)+2g=1
第二个方程 a/(1+x^2)+r-2g(x-r)=x
我要两个方程合并消去a,变成x=?这样的式子,
把第一个方程表示成
g=1/2-a*x/(1+x^2)带入第二个方程:
得:a/(1+x^2)+r-2*(1/2-a*x/(1+x^2))*(x-r)=x
>> syms a r;
[x]=solve('a/(1+x^2)+r-2*(1/2-a*x/(1+x^2))*(x-r)=x')
x =
1/6*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)-6*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+1/3*r+1/3*a
-1/12*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+3*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+1/3*r+1/3*a+1/2*i*3^(1/2)*(1/6*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+6*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3))
-1/12*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+3*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+1/3*r+1/3*a-1/2*i*3^(1/2)*(1/6*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+6*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3))
g=1/2-a*x/(1+x^2)带入第二个方程:
得:a/(1+x^2)+r-2*(1/2-a*x/(1+x^2))*(x-r)=x
>> syms a r;
[x]=solve('a/(1+x^2)+r-2*(1/2-a*x/(1+x^2))*(x-r)=x')
x =
1/6*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)-6*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+1/3*r+1/3*a
-1/12*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+3*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+1/3*r+1/3*a+1/2*i*3^(1/2)*(1/6*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+6*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3))
-1/12*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+3*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+1/3*r+1/3*a-1/2*i*3^(1/2)*(1/6*(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3)+6*(1/3+1/9*a*r-1/9*r^2-1/9*a^2)/(72*r+18*a-12*a*r^2-12*a^2*r+8*r^3+8*a^3+6*(96*r^2-39*a^2-12*a^2*r^2-72*a*r^3-12*a^3*r+24*a^3*r^3-12*a^2*r^4-12*a^4*r^2+48+48*r^4+24*a^4+120*a*r)^(1/2))^(1/3))