How to expand the solve answer?
    15 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hi,
when I run the code
clear; clc;
syms x
y = 3*x.^2 - 10*x + 1.01;
solve(y == 1, x)
this give me the answer
5/3 - 2497^(1/2)/30
2497^(1/2)/30 + 5/3
How can I expand these to 
0.0010
3.3323
Thank you very much!
0 件のコメント
回答 (2 件)
  John D'Errico
      
      
 2021 年 5 月 21 日
        You want to convert them to floating point numbers. 
syms x
y = 3*x.^2 - 10*x + 1.01;
xsol = solve(y == 1, x);
vpa(xsol) % produces a floating point symbolic number, so many digits
double(xsol) % produces a double precision version
  EmirBeg
      
 2021 年 5 月 21 日
        Try vpasolve();
clear; clc;
syms x
y = 3*x.^2 - 10*x + 1.01;
vpasolve(y == 1, x)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



