搜索内容 搜索用户

# 15 麦片

050

4主题 0最佳答案
 syms a b; solve(a-a^3-b==0,a) ans = root(z^3 - z + b, z, 1) root(z^3 - z + b, z, 2) root(z^3 - z + b, z, 3) 我用solve解符号方程，为什么结果是个向量，还是root函数 我想要得到一个符号表达式

# 109 麦片

50500

1主题 22最佳答案

 y=solve(....) 然后试试roots(y)

# 15 麦片

050

4主题 0最佳答案
楼主| 发表于 2020-4-18 17:41:31 | 显示全部楼层
 18833126693 发表于 2020-4-18 17:11 y=solve(....) 然后试试roots(y) 谢谢您的回答，我试了你这个方法，可以有解，但是没有实数解咋办。也就是说只有两个虚数解，而我想要的是实数解，求解答 > syms a; >> a=solve(a-a^3-1==0,a) a = root(z^3 - z + 1, z, 1) root(z^3 - z + 1, z, 2) root(z^3 - z + 1, z, 3) >> b=roots(a) b = -((3^(1/2)*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*1i)/2 + (4*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*((3^(1/2)*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*1i)/2 + 1/(6*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)/2) + (1/(6*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (3^(1/2)*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*1i)/2 + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)/2)^2)^(1/2) - 1/(6*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)/2)/(2*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)))   (1/(6*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (4*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*((3^(1/2)*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*1i)/2 + 1/(6*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)/2) + (1/(6*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (3^(1/2)*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*1i)/2 + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)/2)^2)^(1/2) - (3^(1/2)*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) - (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3))*1i)/2 + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)/2)/(2*(1/(3*(1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)) + (1/2 - (23^(1/2)*108^(1/2))/108)^(1/3)))

# 109 麦片

50500

1主题 22最佳答案

 lt0000 发表于 2020-4-18 17:41 谢谢您的回答，我试了你这个方法，可以有解，但是没有实数解咋办。也就是说只有两个虚数解，而我想要的是 ... 那就用b=vpa(a)试试

# 15 麦片

050

4主题 0最佳答案
楼主| 发表于 2020-4-19 15:42:21 | 显示全部楼层
 本帖最后由 lt0000 于 2020-4-19 15:48 编辑 18833126693 发表于 2020-4-19 02:50 那就用b=vpa(a)试试 >> syms a b; a=vpa(solve(a-a^3-b==0,a)); >> a(1) ans = 0.33333333333333333333333333333333/((0.25*b^2 - 0.037037037037037037037037037037037)^(1/2) - 0.5*b)^(1/3) + ((0.25*b^2 - 0.037037037037037037037037037037037)^(1/2) - 0.5*b)^(1/3) 这样取第一个解就行了，谢谢大佬！！

 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页