Show answers in command prompt in decimal form
2 views (last 30 days)
Show older comments
Hello I would like to make it so everything I "calculate" using the editor window will show up in the command window in decimal form.... Currently the command window likes to show it in fractional form like this.....
x0 =
(609*sin(3137475482873511/281474976710656 - 2*atan(11258999068426240/272960367009995457 - 74634127018254239162355017481176449^(1/2)/272960367009995457))*exp(-40/87))/(20000*sin(2*atan(11258999068426240/272960367009995457 - 74634127018254239162355017481176449^(1/2)/272960367009995457))) + 609/20000
v0 =
(1910722569069968199*cos(3137475482873511/281474976710656 - 2*atan(11258999068426240/272960367009995457 - 74634127018254239162355017481176449^(1/2)/272960367009995457))*exp(-40/87))/(22517998136852480000*sin(2*atan(11258999068426240/272960367009995457 - 74634127018254239162355017481176449^(1/2)/272960367009995457))) - (7*sin(3137475482873511/281474976710656 - 2*atan(11258999068426240/272960367009995457 - 74634127018254239162355017481176449^(1/2)/272960367009995457))*exp(-40/87))/(2000*sin(2*atan(11258999068426240/272960367009995457 - 74634127018254239162355017481176449^(1/2)/272960367009995457)))
I know that you can use commands like vpa or just simply copying and pasting the nomber back into the command prompt will yield an easier to read version, however I would like to set a setting that will alway no matter what will calculate it down to a decimal version, thanks in advance for any help!
0 Comments
Answers (1)
John D'Errico
on 30 Aug 2015
Edited: John D'Errico
on 30 Aug 2015
Sorry, but no. You cannot simply set a flag that will automatically call vpa for you on every result.
As well, copying and pasting a result like that will convert it to a double, NOT a symbolic result. So you may well end up with a significant precision loss when you do so. Be careful, as if there is subtractive cancellation involved, the result as a double may be meaningless.
2 Comments
Walter Roberson
on 30 Aug 2015
"close all" in any program is typically a mistake, and "clear all" in a program is always a mistake.
There is no setting for automatically using vpa. You can use the vpa() command at need.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!