Thread Subject: more than 16 place precision required

Subject: more than 16 place precision required

From: Jacky

Date: 1 Aug, 2009 07:07:01

Message: 1 of 10

i realized that when we do mathematical operations to a number with more than 16 digits, say 12345678901234567890 (20 digits), and when i multiply that by 1, i will only get 16 digits rounded number. do you noe how to increase the number of digits for mathmatical operations?
the problem that i am trying to solve is a system of 17 equations, and the maximum degree is 17, where as the maximum value for x is 17, therefore, the y value for that particular x will be 17^17 for instance.
i am also using matlab b/c i need to use the matrix operations, including rref function and things like this.
if matlab really can't do this task, any suggestions for convenient solutions?
thanks

Subject: more than 16 place precision required

From: John D'Errico

Date: 1 Aug, 2009 11:28:03

Message: 2 of 10

"Jacky " <jackywang529@hotmail.com> wrote in message <h50pik$4rd$1@fred.mathworks.com>...
> i realized that when we do mathematical operations to a number with more than 16 digits, say 12345678901234567890 (20 digits), and when i multiply that by 1, i will only get 16 digits rounded number. do you noe how to increase the number of digits for mathmatical operations?
> the problem that i am trying to solve is a system of 17 equations, and the maximum degree is 17, where as the maximum value for x is 17, therefore, the y value for that particular x will be 17^17 for instance.
> i am also using matlab b/c i need to use the matrix operations, including rref function and things like this.
> if matlab really can't do this task, any suggestions for convenient solutions?
> thanks

So learn to use symbolic computations, where higher
precision is supported. Or, learn enough numerical
analysis to find ways to improve your problem. Or
accept that no matter how many digits are provided,
there will be some fool out there who insists they are
not enough because they cannot be bothered to do
one of the first two options I suggested.

John

Subject: more than 16 place precision required

From: Juliette Salexa

Date: 2 Aug, 2009 00:48:02

Message: 3 of 10

You may want to try this package that claims to support multiple precision:
http://www.mathworks.com/matlabcentral/fileexchange/6446

I haven't tried it, and it looks like it's only compatable with a selective set of numerical schemes.

--------------------------
The fact that matlab doesn't support quadruple precision internally is actually a huge problem with matlab that I've been pushing to get fixed for the next version. The problem is that many matlab functions rely on library packages that were built for double precision, and a lot of work would need to be redone to allow for quadruple precision.

John D'Erico,
Using symbolic computation is not always a solution.
The best way to find the eigenvalues of a 3x3 matrix is numerically, NOT symbolically.
There is a formula to find the eigenvalues symbolically (Cardano's formula), but the expression is so complicated that evaluating it with 1000 digits of precision gives a result that's less accurate than finding the eigenvalues numerically using Jacobi rotations with only DOUBLE precision!! [it's unintuitive but true!]

There are countless cases like this. And often times double precision is not enough, EVEN with the BEST known numerical schemes.

Calling us "fools" for needing quadruple precision seems a bit sophistic.

Quadruple precision would actually help TREMENDOUSLY:
Look at the difference between single and double precision!
In my work, single precision is enough 10% of the time
double precision is enough 90% of the time
and quadruple precision is enough 99.999% of the time.

Sure, 0.001% of the time I'll need to use higher precision, and therefore re-program everything in fortran, but the fact that quadruple precision would help me for that 9.999% more, makes it worth it.

Conclusion: Not many people will be asking for higher precision after quadruple, but many people benefit from it being there.

Subject: more than 16 place precision required

From: TideMan

Date: 2 Aug, 2009 01:18:04

Message: 4 of 10

On Aug 1, 7:07 pm, "Jacky " <jackywang...@hotmail.com> wrote:
> i realized that when we do mathematical operations to a number with more than 16 digits, say 12345678901234567890 (20 digits), and when i multiply that by 1, i will only get 16 digits rounded number. do you noe how to increase the number of digits for mathmatical operations?
> the problem that i am trying to solve is a system of 17 equations, and the maximum degree is 17, where as the maximum value for x is 17, therefore, the y value for that particular x will be 17^17 for instance.
> i am also using matlab b/c i need to use the matrix operations, including rref function and things like this.
> if matlab really can't do this task, any suggestions for convenient solutions?
> thanks

So, you've got an equation like this:
y=1 + a*x^17
and a ~ 1e-20 and x=17
and you're saying you need 20 digits of precision because 17^17 ~
8e20, so a*x^17 is O(1).

Well, this just reinforces John's comment about fools...........

Subject: more than 16 place precision required

From: Juliette Salexa

Date: 2 Aug, 2009 01:32:03

Message: 5 of 10

I think there's more to Jacky's problem that wasn't clear in the initial question.

what PARTICULAR matlab functions are you using that makes you need to use NUMERICAL computation in matlab ??

rref can be done in maple or mathematica [and probably also matlab's symbolic toolbox, although i don't use it] easily for 17x17 matrices.

Even if you're trying to solve non-linear systems of order 17, maple can do that.

Is there a particular reason why you're using symbolic computation here ??

Subject: more than 16 place precision required

From: omegayen

Date: 2 Aug, 2009 03:00:20

Message: 6 of 10

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h52qaj$fgd$1@fred.mathworks.com>...
> I think there's more to Jacky's problem that wasn't clear in the initial question.
>
> what PARTICULAR matlab functions are you using that makes you need to use NUMERICAL computation in matlab ??
>
> rref can be done in maple or mathematica [and probably also matlab's symbolic toolbox, although i don't use it] easily for 17x17 matrices.
>
> Even if you're trying to solve non-linear systems of order 17, maple can do that.
>
> Is there a particular reason why you're using symbolic computation here ??

a solution is to get maple........ and then get the maple toolbox for matlab......

this allows you to use matlab, but have higher precision as in maple

however, some matlab functions will not allow you to use them symbolically, but others will, or try to see if just using maple is right for you.

Subject: more than 16 place precision required

From: Jacky

Date: 4 Aug, 2009 05:01:18

Message: 7 of 10

Hi everyone,
thanks for taking up time to look through my question. There are certainly tons of possibilities out there that i can use to approach this problem of mine. more than just matlab. however, as i am not quite familiar with any other programming and computer programming, i am rather stuck with matlab, not that it's a bad tool or anything, it's just that i am not that familiar with it, so i am most likely not aware of all its possibilities.

i use matlab, b/c to me, it's very easy to program, so i don't have to type in 17 by 17 system of linear equations, and later on another 35 by 35 one.

the numerical/programming functions that i am using is in fact quite rudimentary. they are rref, matrix concatenation.

thanks again for whoever replies to my problem.

Subject: more than 16 place precision required

From: Jacky

Date: 4 Aug, 2009 05:01:18

Message: 8 of 10

Hi everyone,
thanks for taking up time to look through my question. There are certainly tons of possibilities out there that i can use to approach this problem of mine. more than just matlab. however, as i am not quite familiar with any other programming and computer programming, i am rather stuck with matlab, not that it's a bad tool or anything, it's just that i am not that familiar with it, so i am most likely not aware of all its possibilities.

i use matlab, b/c to me, it's very easy to program, so i don't have to type in 17 by 17 system of linear equations, and later on another 35 by 35 one.

the numerical/programming functions that i am using is in fact quite rudimentary. they are rref, matrix concatenation.

thanks again for whoever replies to my problem.

Subject: more than 16 place precision required

From: Bruno Luong

Date: 4 Aug, 2009 06:50:18

Message: 9 of 10

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h52no2$838$1@fred.mathworks.com>...
> You may want to try this package that claims to support multiple precision:
> http://www.mathworks.com/matlabcentral/fileexchange/6446
>
> I haven't tried it, and it looks like it's only compatable with a selective set of numerical schemes.
>
> --------------------------
> The fact that matlab doesn't support quadruple precision internally is actually a huge problem with matlab that I've been pushing to get fixed for the next version. The problem is that many matlab functions rely on library packages that were built for double precision, and a lot of work would need to be redone to allow for quadruple precision.
>
> John D'Erico,
> Using symbolic computation is not always a solution.
> The best way to find the eigenvalues of a 3x3 matrix is numerically, NOT symbolically.
> There is a formula to find the eigenvalues symbolically (Cardano's formula), but the expression is so complicated that evaluating it with 1000 digits of precision gives a result that's less accurate than finding the eigenvalues numerically using Jacobi rotations with only DOUBLE precision!! [it's unintuitive but true!]
>
> There are countless cases like this. And often times double precision is not enough, EVEN with the BEST known numerical schemes.
>
> Calling us "fools" for needing quadruple precision seems a bit sophistic.
>
> Quadruple precision would actually help TREMENDOUSLY:
> Look at the difference between single and double precision!
> In my work, single precision is enough 10% of the time
> double precision is enough 90% of the time
> and quadruple precision is enough 99.999% of the time.
>
> Sure, 0.001% of the time I'll need to use higher precision, and therefore re-program everything in fortran, but the fact that quadruple precision would help me for that 9.999% more, makes it worth it.
>
> Conclusion: Not many people will be asking for higher precision after quadruple, but many people benefit from it being there.

Don't be confused by the stability of the your algorithm and the precision you need. If the designed numerical method does not have robustness required, then it is a bad method. Some people try to put the dust under the carpet by using higher precision, but it sill a flawed code.

Most of the device we use daily have ADC about 20 bits, that's no more than single number. DOUBLE would cover 99.999% of the time, and the 0.001% if for applications such as atomic clock time (I believe a Nobel price few year ago is rewarded to the inventors of a frequency comb generator of 15 digit precision).

That's why numerical calculus is teach at school: Cauchy criterion, Stiff ODE, CFL condition, convergent study of FE, well-posedness and ill-posedness, inverse problem and Tichkonov regularization.

Bruno

Subject: more than 16 place precision required

From: Juliette Salexa

Date: 5 Aug, 2009 21:22:04

Message: 10 of 10

> Don't be confused by the stability of the your algorithm and the precision you >need. If the designed numerical method does not have robustness required, then i>t is a bad method. Some people try to put the dust under the carpet by using >higher precision, but it sill a flawed code.


1. There's problems where the BEST known algorithms are simply not accurate enough. Perhaps they're not good methods, but they're all we have!

2. When comparing matlab's EIG function to my Jacobi rotations FORTRAN code, where both matlab and FORTRAN are both using double precision... I get different answers (FORTRAN being more accurate because my code does more iterations).

The primary reason why I use matlab is to check whether my fortran code is right... but because of this.. it's almost useless.

The solutions are not great either:
1. Go into the eig function (that someone ELSE wrote), figure out how the heck it works and improve it.
2. Re-write a better eig function

In cases like this, rather than resorting to the above two rather tedius solutions, why not use EIG just the way it is... only with higher precision ?? [ And the symbolic toolbox or maple, are NOT useful here! ]

But I see your point, in this case using more digits might not help much... it would be hard for me to find a concrete example off the top of my head where using more digits actually beats using more iterations in the algorithm.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
increase digits... Sprinceana 1 Aug, 2009 04:24:49
rssFeed for this Thread

Contact us at files@mathworks.com