Also, is there a way in MATLAB to judge when a symbolic computation will complete or not? Sometimes the memory requirements on my computer are fine, but the program might not complete. I would like to know of a better way, if possible, to judge/evaluate a MATLAB program to have a better idea if it will complete the run or not.
Exponentiation Turns Values Into Zeros.
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BM
el 12 de Abr. de 2018
Comentada: BM
el 18 de Abr. de 2018
After I solved an equation, I have good non-zero, numerical data. After exponentiation, some of these values go to zero, so literally MATLAB sees them as zeros. I tried a few symbolic computations, but some of them don't seem to complete due to the memory constraints, or my values would now be set in symbolic form, which destroys the program output. Would MATLAB have a way of increasing accuracy of the computation, being as gentle on memory requirements as possible, but without converting everything to symbolic form?
1 comentario
Respuesta aceptada
John D'Errico
el 12 de Abr. de 2018
Editada: John D'Errico
el 12 de Abr. de 2018
No, you cannot tell MATLAB to increase the accuracy of computation. Numbers are doubles. Or they are symbolic. Or you could use my HPF toolbox, but that is similar in its limitations to symbolic computations.
Double precision numbers will underflow if you push things too far. You cannot change that behavior.
exp([-745 -746])
ans =
4.9407e-324 0
exp([-745 -746]) == 0
ans =
1×2 logical array
0 1
And, no. There is no way in advance to know if or when a given arbitrary computation will terminate. For example, suppose your program was something simple, like finding and computing the 51'st perfect number? (As of this moment, it seems only 50 are known because even perfect numbers are directly related to Mersenne primes.)
It might even be a simpler question, like finding the second prime number of the form (n+1)*17^n-1. Even the first prime is pretty large. I won't tell you what value of n that is. ;-) And all I know about the second prime of that form, IF one exists, is that n must be at least as large as 23000 or so.
Some computations are tractable, in the sense that you can predict if and when they will terminate. For example, suppose you will use a scheme to compute pi to 1 million digits? (Not that hard, really.) There are simple schemes that compute essentially a fixed number of digits per iteration. So you can easily predict roughly how many iterations will be required.
But if you just write some general mess of code, there is no way to predict in advance when or if it will terminate. Sorry. For example, while I'm pretty sure that before long, having used only about a year's worth of computer time, the 51st Mersenne prime will have been found, and therefore the 51'st perfect number will be known too. But I have no idea if a second prime of the form (n+1)*17^n-1 exists at all.
To a large extent, knowing if a code will terminate (and how long it might take) relies on your understanding of the computations being done. Essentially, to use a mathematical tool, it helps if you understand the mathematics behind what will be done.
8 comentarios
John D'Errico
el 18 de Abr. de 2018
If they are turning into true zeros, thus an underflow after exponentiation, then they are essentially less than
log(realmin/2^52)
ans =
-744.44
Más respuestas (0)
Ver también
Categorías
Más información sobre Number Theory en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!