How I can obtain the numerical values of a symbolic results?
29 次查看(过去 30 天)
显示 更早的评论
For example, I have this expression -(5^(1/2)*i - (1 - 3*5^(1/4))^(1/2) + 5*i)/(8*pi), how I can obtain the numerical result?
2 个评论
John Chilleri
2017-1-23
编辑:John Chilleri
2017-1-23
If I type,
a = -(5^(1/2)*i - (1 - 3*5^(1/4))^(1/2) + 5*i)/(8*pi)
a =
0.0000 - 0.2136i
Does this not work for you?
When I did work with huge numbers (100s of digits), Matlab would leave it as symbols like you have when, I assume, it could not do the computation. I ended up using Maxima for these symbolic computations then going back to Matlab with the result. I don't imagine Matlab can't compute it unless it's obscenely large or contains portions that don't convert to mathematics.
回答(1 个)
Niels
2017-1-23
of you have a symbolic expression use double (a is of class sym)
a=double(a)
3 个评论
Niels
2017-1-23
is i said, if u got something like
result=solve(...)
result is a variable of class sym
try
result=double(result)
and your problem is solved
John D'Errico
2017-1-23
Double will produce a double precision result. If you want a symbolic result that has still many digits, use vpa.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!