Show answers in command prompt in decimal form

4 views (last 30 days)
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!

Answers (1)

John D'Errico
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
Eli Kroitor
Eli Kroitor on 30 Aug 2015
hmmmm I see thanks for posting, I find it so unbelievably wierd that matlab would not have a settings tab to atleast visually show answers in the command window as decimals, because its a great visual aid f0r stupid people who can not calculate big nombers with fractions in their minds, This would really help with my debugging of my mistakes, welp I guess ill just take out my casio calculator every time and punch the nombers in to calculate calculate them down to a decimal haha xD (btw im joking no way in hell am i doing that for any fractional nomber that has around....... 100 nombers and 10 minuses and pluses)
Is there any command line i can put in the editor??? they have a command line to "close all/clear all"
Walter Roberson
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.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!