Internal Precision - Symbolic

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Internal Precision - Symbolic

EduardoHenrique
Hi.

I am a college student and I have some exercises to do. One of them need me to implement Gaussian elimination with 3 digit-chopping arithmetic. It's not that my answer must have only three-digit precision, but all values that are being calculated must have this precision. The exercise wants this particularly requirement to compare with the real solution and compute the error provided by this poor precision.

I've done the implementation of the method, but as I was able to see, Octave uses all it's internal precision, and that makes the error null. I didn't find any way to reduce it's internal precision. Actually, I've installed the symbolic package, but it didn't work out well. With matrices it didn't change anything and with numbers, even making digits(3) it insists to give me five digits.

I know that Octave is efficient with precision, but how can I change that in order to make this computational error and compare it to the real value?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Internal Precision - Symbolic

Jordi Gutiérrez Hermoso-2
On 13 October 2012 10:36, EduardoHenrique <[hidden email]> wrote:
> I know that Octave is efficient with precision, but how can I change that in
> order to make this computational error and compare it to the real value?

No. Octave's precision is defined by your CPU's implementation of
double precision, i.e. it's defined by your hardware. It can't be
changed in software.

The vpa function from the symbolic package is very limited and nearly
useless. The symbolic package for example doesn't work with matrices.

I recommend you use another program. I know in Maxima you can set the
fprec variable to use variable-precision for floating point
arithmetic.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Internal Precision - Symbolic

EduardoHenrique
Thanks for your answer.

I know it would be easier to go to a symbolic software. But I've my scripts all set in Octave. Unfortunately Maxima programming language differs a lot of Octave/Matlab/Scilab and isn't "comfortable".

It seems that Matlab offers this tool (VPA), but it happen to use Maple (comercial symbolic tool) to do the symbolic calculations. Isn't there a way that Octave could be integrated with Maxima? Or is there a numerical software which language is similar to Octave/Matlab and supports this variable precision arithmetic?

If not, I was thinking about one solution to my problem, see if you agree:
Suppose I want to use VPA in every calculation in Octave. Would it be possible to force Octave to execute a script after every calculation it does? If so, I could force him to eliminate any digits beyond the ones I want. The doubt is: where (in the source
code) can I add the code to force it to execute a function after any evaluation it does?

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Internal Precision - Symbolic

Laurent Hoeltgen
Hi,

On 21/10/12 17:40, EduardoHenrique wrote:
> Thanks for your answer.
>
> I know it would be easier to go to a symbolic software. But I've my scripts
> all set in Octave. Unfortunately Maxima programming language differs a lot
> of Octave/Matlab/Scilab and isn't "comfortable".

The syntax of maxima is certainly different from the one used in octave.
I wouldn't call it "uncomfortable". It serves a different purpose and
for that one it's probably better suited than octave's.

>
> It seems that Matlab offers this tool (VPA), but it happen to use Maple
> (comercial symbolic tool) to do the symbolic calculations. Isn't there a way
> that Octave could be integrated with Maxima? Or is there a numerical
> software which language is similar to Octave/Matlab and supports this
> variable precision arithmetic?

If I remember right, Matlab uses a software called Mupad for symbolic
computations. Mupad used to be a standalone software package for
symbolic computations. Mathworks bought the company that developed it
years ago and integrated into the symbolic math toolbox. See
http://de.wikipedia.org/wiki/MuPAD

Maybe you could take a look at Sage (http://www.sagemath.org/) It
combines several packages for numerical as well as symbolic computations
under a single frontend. As far as I know, you can call octave as well
as maxima from it. But be warned, the thing is very large in terms of
necessary disk space.


>
> If not, I was thinking about one solution to my problem, see if you agree:
> Suppose I want to use VPA in every calculation in Octave. Would it be
> possible to force Octave to execute a script after every calculation it
> does? If so, I could force him to eliminate any digits beyond the ones I
> want. The doubt is: where (in the source
> code) can I add the code to force it to execute a function after any
> evaluation it does?

I'm not familiar enough with octave's source code but I doubt anything
like this is possible.

>
> Thanks for your help!
>
>
>
>
> --
> View this message in context: http://octave.1599824.n4.nabble.com/Internal-Precision-Symbolic-tp4645257p4645568.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave
>

Regards,
Laurent

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Internal Precision - Symbolic

Jordi Gutiérrez Hermoso-2
In reply to this post by EduardoHenrique
On 21 October 2012 11:40, EduardoHenrique <[hidden email]> wrote:
> If not, I was thinking about one solution to my problem, see if you agree:
> Suppose I want to use VPA in every calculation in Octave.

If you care enough about this problem, you could fix the vpa()
function from the symbolic package to actually work with matrices. If
you don't care enough, then use something other than Octave. These are
essentially your only options.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Internal Precision - Symbolic

Jordi Gutiérrez Hermoso-2
On 21 October 2012 15:19, Jordi Gutiérrez Hermoso <[hidden email]> wrote:
> On 21 October 2012 11:40, EduardoHenrique <[hidden email]> wrote:
>> If not, I was thinking about one solution to my problem, see if you agree:
>> Suppose I want to use VPA in every calculation in Octave.
>
> If you care enough about this problem, you could fix the vpa()
> function from the symbolic package to actually work with matrices. If
> you don't care enough, then use something other than Octave. These are
> essentially your only options.

I forgot to mention a third option: if you're incapable of fixing the
vpa() function yourself, you can raise money for someone else to do
it. I would do it for the low, low cost of 5000 CAD (cheap!), along
with making the rest of the functions in the symbolic package work
with matrices. It's one of the TODO tasks for this package, which has
been queued for about 7 years, iirc.

Setup a kickstarter for it, let me know if it hits the 5000 CAD
threshold, and I can get this done within a month.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave