matlab写公式五元二次方程组用matlab能写出来吗?请给个例子
2019-05-28
matlab写公式
五元二次方程组用matlab能写出来吗?请给个例子
优质解答
给个例子,注意并不是所有的五元二次方程组都有解.
syms x y z s t
f1=x+y-z+s+t;
f2=x^2-y^2+2*z;
f3=x*y+s*t;
f4=z-s*t;
f5=x^2+y^2-2*t;
[x,y,z,s,t]=solve(f1,f2,f3,f4,f5);
解得:
x =
0
1/2*2^(1/2)
1/2*2^(1/2)
-1/2*2^(1/2)
-1/2*2^(1/2)
y =
0
1+(-2-2*2^(1/2))^(1/2)
1-(-2-2*2^(1/2))^(1/2)
1+(-2+2*2^(1/2))^(1/2)
1-(-2+2*2^(1/2))^(1/2)
z =
0
-(2^(1/2)-1)*(1+(-2-2*2^(1/2))^(1/2))/(1/2*2^(1/2)*(1+(-2-2*2^(1/2))^(1/2))-1/2*2^(1/2)-1-(-2-2*2^(1/2))^(1/2))
-(2^(1/2)-1)*(1-(-2-2*2^(1/2))^(1/2))/(1/2*2^(1/2)*(1-(-2-2*2^(1/2))^(1/2))-1/2*2^(1/2)-1+(-2-2*2^(1/2))^(1/2))
-(-1-2^(1/2))*(1+(-2+2*2^(1/2))^(1/2))/(-1/2*2^(1/2)*(1+(-2+2*2^(1/2))^(1/2))+1/2*2^(1/2)-1-(-2+2*2^(1/2))^(1/2))
-(-1-2^(1/2))*(1-(-2+2*2^(1/2))^(1/2))/(-1/2*2^(1/2)*(1-(-2+2*2^(1/2))^(1/2))+1/2*2^(1/2)-1+(-2+2*2^(1/2))^(1/2))
s =
0
1/(1/2*2^(1/2)*(1+(-2-2*2^(1/2))^(1/2))-1/2*2^(1/2)-1-(-2-2*2^(1/2))^(1/2))*(1+(-2-2*2^(1/2))^(1/2))
1/(1/2*2^(1/2)*(1-(-2-2*2^(1/2))^(1/2))-1/2*2^(1/2)-1+(-2-2*2^(1/2))^(1/2))*(1-(-2-2*2^(1/2))^(1/2))
1/(-1/2*2^(1/2)*(1+(-2+2*2^(1/2))^(1/2))+1/2*2^(1/2)-1-(-2+2*2^(1/2))^(1/2))*(1+(-2+2*2^(1/2))^(1/2))
1/(-1/2*2^(1/2)*(1-(-2+2*2^(1/2))^(1/2))+1/2*2^(1/2)-1+(-2+2*2^(1/2))^(1/2))*(1-(-2+2*2^(1/2))^(1/2))
t =
0
1/2*2^(1/2)*(1+(-2-2*2^(1/2))^(1/2))
1/2*2^(1/2)*(1-(-2-2*2^(1/2))^(1/2))
-1/2*2^(1/2)*(1+(-2+2*2^(1/2))^(1/2))
-1/2*2^(1/2)*(1-(-2+2*2^(1/2))^(1/2))
给个例子,注意并不是所有的五元二次方程组都有解.
syms x y z s t
f1=x+y-z+s+t;
f2=x^2-y^2+2*z;
f3=x*y+s*t;
f4=z-s*t;
f5=x^2+y^2-2*t;
[x,y,z,s,t]=solve(f1,f2,f3,f4,f5);
解得:
x =
0
1/2*2^(1/2)
1/2*2^(1/2)
-1/2*2^(1/2)
-1/2*2^(1/2)
y =
0
1+(-2-2*2^(1/2))^(1/2)
1-(-2-2*2^(1/2))^(1/2)
1+(-2+2*2^(1/2))^(1/2)
1-(-2+2*2^(1/2))^(1/2)
z =
0
-(2^(1/2)-1)*(1+(-2-2*2^(1/2))^(1/2))/(1/2*2^(1/2)*(1+(-2-2*2^(1/2))^(1/2))-1/2*2^(1/2)-1-(-2-2*2^(1/2))^(1/2))
-(2^(1/2)-1)*(1-(-2-2*2^(1/2))^(1/2))/(1/2*2^(1/2)*(1-(-2-2*2^(1/2))^(1/2))-1/2*2^(1/2)-1+(-2-2*2^(1/2))^(1/2))
-(-1-2^(1/2))*(1+(-2+2*2^(1/2))^(1/2))/(-1/2*2^(1/2)*(1+(-2+2*2^(1/2))^(1/2))+1/2*2^(1/2)-1-(-2+2*2^(1/2))^(1/2))
-(-1-2^(1/2))*(1-(-2+2*2^(1/2))^(1/2))/(-1/2*2^(1/2)*(1-(-2+2*2^(1/2))^(1/2))+1/2*2^(1/2)-1+(-2+2*2^(1/2))^(1/2))
s =
0
1/(1/2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