10/06/2021, 07:18 PM
(This post was last modified: 10/07/2021, 04:40 AM by Ember Edison.)
(10/05/2021, 12:46 AM)JmsNxn Wrote: Hey, Ember
What do you think is the most efficient way to assign overflows/underflows a gray value.
First we need to define what overflows and underflows are. It's simple.
Too far from 0 is an overflow, too close to 0 is a underflow. Whether real or complex or quaternion or p-adic floating-point numbers are defined in this way, it is right.
Second, why we need to separate Overflow and Underflow. It's simple too.
You can see the typical characteristics of tetration in your tetration picture: the black and white striped "petals". If we have separated Overflow and Underflow, then we can still capture the bounds of the moment when both transitions occur.
If we are not prepared for this, we can only know the Pari-GP strike from the sexp function.
Third, how do we separate Overflow and Underflow. A simple way to handle this is:
After tetration enters the iterative process, each iteration makes a determination of whether it is converging to 0. (It is not difficult to determine whether it is far from 0 or approaching 0, even if you are using a series rather than an iteration)
If ture, underflow_test = 1. Then trap(e_OVERFLOW, if(underflow_test == 1, error(z" is too close to 0!"), sexp(z)), sexp(z))
Finally, we can also do some processing to reduce underflow. like:
Code:
Chop(z, {delta="Automatic"})={local(dd);
if(delta=="Automatic", trap(,1E-80807124,dd=abs(log(4E-347063955532709820*(1+I))));if(dd>7E17,dd=4E-347063955532709820), dd=delta);
/* x86-32/x86-64 test */
if((real(z)!=0)&&(imag(z)<=dd),return(real(z)));
if((imag(z)!=0)&&(real(z)<=dd),return(imag(z)*I));
return(0)
}Then create a new function NSexp(), perform a chop() for every important calculation
If the calculation only leaves logs to be processed, it might still be possible to use log Identity to avoid logs hitting the Pari-GP limit, but I'm too lazy to think of a concrete solution
I tried it, it didn't work, it's likely that the identity I'm using is the route Pari-GP uses to calculate the complex log, so don't waste time.
Code:
SafeArg(z) ={trap(,
if (imag(z)!=0, return(2*arctan(imag(z)/(sqrt(real(z)^2+imag(z)^2)+x))));
if (real(z)>0, return(Pi));
return(0),
arg(z));
}
SafeLog(z) ={trap(,
I*SafeArg(z)+log(real(z)^2+imag(z)^2),
log(z));
}
