Calculus with Matlab or octave

View: New views
4 Messages — Rating Filter:   Alert me  

Calculus with Matlab or octave

by friend :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear friends,

when we make some simple calculus with Octave or Matlab, how to have precise results in more than 4 decimal numbers.

example:2.9014567*8.9665531;#the result in Octave prompt is

ans=26.016

I would like to obtain a result with also six decimal figures and not three(016).

Thank you very much




Vous aussi bénéficiez d' 1 Go de stockage gratuit en ligne avec Voila http://macle.voila.fr

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: Calculus with Matlab or octave

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 9, 2008, at 7:39 PM, hassen62@... wrote:

> Dear friends,
>
> when we make some simple calculus with Octave or Matlab, how to have  
> precise results in more than 4 decimal numbers.
>
> example:2.9014567*8.9665531;#the result in Octave prompt is
>
> ans=26.016
>
> I would like to obtain a result with also six decimal figures and  
> not three(016).
>
> Thank you very much
>

Its not exactly "Calculus", but if you want more precision ...

        > x = 2.9014567*8.9665531;
        > num2str (x, "%16.12g")

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: Calculus with Matlab or octave

by Jordi Gutiérrez Hermoso-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09/05/2008, hassen62@... <hassen62@...> wrote:
> when we make some simple calculus with Octave or Matlab, how to have precise
> results in more than 4 decimal numbers.

Octave uses double precision floats for almost everything which is
about 16 decimal digits of precision. It just doesn't show all that
precision by default, even if it does use it for computations.

If you want to see it, just type "format long", which will make Octave
display it.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: Calculus with Matlab or octave

by Sergei Steshenko-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


--- Jordi Gutiérrez Hermoso <jordigh@...> wrote:

> On 09/05/2008, hassen62@... <hassen62@...> wrote:
> > when we make some simple calculus with Octave or Matlab, how to have precise
> > results in more than 4 decimal numbers.
>
> Octave uses double precision floats for almost everything which is
> about 16 decimal digits of precision. It just doesn't show all that
> precision by default, even if it does use it for computations.
>
> If you want to see it, just type "format long", which will make Octave
> display it.
>
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> Help-octave@...
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>

Try also

help output_precision

and use, say,

output_precision(18)
.

Regards,
  Sergei.


Applications From Scratch: http://appsfromscratch.berlios.de/


      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave