Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fast accurate Kneser sexp algorithm
#31
(07/23/2011, 05:48 AM)deepblue Wrote: Is it continuous at 1/2? I got...
sexp(1/2)=1.6376...
sexp(1/2+10^-30)=1.6489...
You're using the initial seed approximation, which is a three term taylor series, along with iterative logs/exps. After initialization, you need to "loop" through iteratively calculating the Kneser theta mapping. After 13 iterations (which takes about 4 seconds), you'll get results accurate to 110 binary bits.
Code:
gp > init(exp(1));loop
   base          2.71828182845904523536029
   fixed point   0.318131505204764135312654 + 1.33723570143068940890116*I
   Pseudo Period 4.44695072006700782711228 + 1.05793999115693918376341*I
generating superf taylor series; inverse Schroder equation, scnt 235
generating isuperf taylor series; Schroder equation, scnt 235
sexp(-0.5)= 0.49855114028767537891166401244655
1=loopcnt  8.842977061 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856330616566898032298548529033
2=loopcnt  17.67523398 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328805247482985620720695870
3=loopcnt  26.43624250 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794127685577078081234199
4=loopcnt  35.02171218 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111357966546850464454
5=loopcnt  43.44600587 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443478679527238125
6=loopcnt  52.16036487 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467429889486618
7=loopcnt  60.48849684 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467961715088127
8=loopcnt  69.25315295 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467961906029415
9=loopcnt  77.65865208 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467961909246830
10=loopcnt  86.52036006 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467961909249278
11=loopcnt  94.54807694 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467961909249313
12=loopcnt  102.8988830 Riemann/sexp binary precision bits
sexp(-0.5)= 0.49856328794111443467961909249313
13=loopcnt  110.6414599 Riemann/sexp binary precision bits
%1 = 1
Code:
gp > sexp(0.5)
%2 = 1.6463542337511945809719240315921
gp > sexp(0.5+1E-30)
%3 = 1.6463542337511945809719240315937
gp >
The separate "init(b)" routine from the "loop" routine is a little confusing. Originally, the kneser.gp program was more of an experiment, although I kind of like to be able to initialize for a base, and see the fixed point, and the pseudo period, before doing the loop. Sometimes I want to manually control the looping....

Anyway, I could change the program in one of two ways that would make it simpler. Both changes I'm thinking of involve putting the "loop;" at the end of the init routine, so that anytime you initialize for a given base, via "init(b)", the program automatically loops through with the current precision, generating the sexp(z) series. Then the question becomes what to do when kneser.gp is first loaded into pari-gp. Since the loop only takes 4-5 seconds for base e, "\p 67", I could have the program fully initialize for base e when it loads, going through the loop of thirteen iterations. Or, I could completely remove the partial initialization for base e when the program loads. Any opinions, as to which makes more sense?
- Sheldon
For the most recent code version: go to the Nov 21st, 2011 thread.
Reply
#32
Sheldon, I'm wondering if I'm doing something wrong here, but whenever I try to plot anything with this function:

Code:
V(a,b,t) = {
  if (real(t)<1,  return(exp2(t,exp2(-t,a)+exp2(-t,b))));
  if (real(t)>=1, return(exp2(t,exp2(-t,a)+exp2(-1,b))));
}

exp2(t, a) = {
  if (a==2, return(2));
  if (a == 4, return(4));
  if (real(a)>2, return(superf(isuperf(a)+t)), return(superf2(isuperf2(a)+t)));
}

I repeatedly get a cryptic Win32 error:
Code:
gp 4852 child_copy: linked dll data write copy failed

This is my proposed "natural" extension to the Ackermann function, I'm confused as to why it won't plot.

I appreciate any help you can give me, thanks.
Reply
#33
(09/04/2011, 08:16 PM)JmsNxn Wrote: Sheldon, I'm wondering if I'm doing something wrong here, but whenever I try to plot anything with this function:

Code:
V(a,b,t) = {
  if (real(t)<1,  return(exp2(t,exp2(-t,a)+exp2(-t,b))));
  if (real(t)>=1, return(exp2(t,exp2(-t,a)+exp2(-1,b))));
}

exp2(t, a) = {
  if (a==2, return(2));
  if (a == 4, return(4));
  if (real(a)>2, return(superf(isuperf(a)+t)), return(superf2(isuperf2(a)+t)));
}

I repeatedly get a cryptic Win32 error:
Code:
gp 4852 child_copy: linked dll data write copy failed

This is my proposed "natural" extension to the Ackermann function, I'm confused as to why it won't plot.

I appreciate any help you can give me, thanks.
I'll take a look. I need to know what base you're initializing for. The Ackermann function means you're probably initializing using base 2? hmmm, looking at your code, you're probably using base sqrt(2), which has two different superfunction solutions and fixed points of 2 and 4. I'll post some more after I do some experiments for base sqrt(2), along with your routine.
- Shel
For the most recent code version: go to the Nov 21st, 2011 thread.
Reply
#34
(09/05/2011, 05:05 AM)sheldonison Wrote:
(09/04/2011, 08:16 PM)JmsNxn Wrote: Sheldon, I'm wondering if I'm doing something wrong here, but whenever I try to plot anything with this function:

Code:
V(a,b,t) = {
  if (real(t)<1,  return(exp2(t,exp2(-t,a)+exp2(-t,b))));
  if (real(t)>=1, return(exp2(t,exp2(-t,a)+exp2(-1,b))));
}

exp2(t, a) = {
  if (a==2, return(2));
  if (a == 4, return(4));
  if (real(a)>2, return(superf(isuperf(a)+t)), return(superf2(isuperf2(a)+t)));
}

I repeatedly get a cryptic Win32 error:
Code:
gp 4852 child_copy: linked dll data write copy failed

This is my proposed "natural" extension to the Ackermann function, I'm confused as to why it won't plot.

I appreciate any help you can give me, thanks.
I'll take a look.... you're probably using base sqrt(2), which has two different superfunction solutions and fixed points of 2 and 4. I'll post some more after I do some experiments for base sqrt(2), along with your routine.
- Shel
I wasn't able to reproduce the error you saw, but I think I know what the problem is. sqrt(2)<eta, which is a special case for the program. The problem I suspect you're having is that I changed the code in this last round of optimizations, so that the superf/isuperf routines now use a power series, but the power series for the superfunction and inverse superfunction only gets calculated when you calculate the kneser mapping, which didn't used to be the case. I forgot that you were using the program the code only for the superfunctions, and not to generate a kneser mapping. I realize you have no interest in the esoteric kneser mapping I calculate for the sqrt(2) base, but it only takes a few seconds to caulcate. The fix for your problem is probably to execute the "loop;" command after init(sqr(2)). Then the graphs I generated for exp2(-2,t) and exp2(+2,t), worked fine.
- Shel
Code:
\r kneser.gp
init(sqrt(2));
loop;
exp2(t, a) = {
  if (a==2, return(2));
  if (a == 4, return(4));
  if (real(a)>2, return(superf(isuperf(a)+t)), return(superf2(isuperf2(a)+t)));
}

ploth(t=1.5,5,z=exp2(2,t);[real(z),imag(z)]);
ploth(t=1.5,5,z=exp2(-2,t);[real(z),imag(z)]);
For the most recent code version: go to the Nov 21st, 2011 thread.
Reply
#35
Yes! thank you sheldon! I was very anxious about being unable to graph these objects, I really appreciate it, thanks.
Reply
#36
Here is the most recent code, Nov 12th, 2013:
.gp   kneser.gp (Size: 35.84 KB / Downloads: 159)
updates Nov 12th 2013; this is the same as the code at the top of the first page
o updated to be compatible with latest pari-gp
o removed eval, and kill
o enhanced prtpoly routine
o added lambertL routine
end updates Nov 12th, 2013

Nov 21st, 2011 version of "kneser.gp", previous version link:
.gp   kneser_backup_110811.gp (Size: 34.36 KB / Downloads: 141) This update is largely cosmetic. I cleaned up a lot of stuff that I've wanted to clean up for a long time. Its stable. I've been using it for a couple of months for experiments, and tests. Here is a list of the changes in this version of "Kneser.gp".

init(base) automatically initializes and then automatically loops through generating the xsexp and xtheta taylor series for future operations. The old loop command is no longer required by the user, but is available as an internal function. "rawinit(base);loop(n);" rawinit is an internal function which is also not generally required by the user, which is the initialization function without looping, so the user can manually control looping. This change will help minimize some user errors, as well as simplify the use of the program.
sexp(z) now works for the entire complex plane. if imag(z)>0.87, the sexp(z) routine automatically switches to using thetaaprx(z). Therefore, the splicesexp(z) routine is no longer necessary, and is now deprecated
internal function name changes: thetaaprx(z) replaces riemaprx(z), which is more accurate, since Knesser's Riemann mapping is not a theta(z) mapping, although the two mappings can be shown to be mathematically equivalent.
internal function name changes: thetaup replaces riemup, to update the xtheta array during loop iteration
internal function name changes: Schroder/iSchroder replaces xisuperf/superf taylor series. These are the polynomial taylor series for the schroder function and inverse schroder functions, which have a radius of approximately rsuper. These names are more consistent with the mathematic's communities literature on iterated functions.
precision fix to sexptaylor and slogtaylor functions, to automatically update resulting polynomial to full precision otherwise, when these taylor series are evaluated via eval(f), they can return inaccurate results
help, and morestuff menus are cleaned up a little bit, which should hopefully make it easier to use the program.
xsexp is no longer initialized at startup. This helps minimize user errors with unitialized data. The cheta routines are still initialized at startup, and the cheta routines are still updated by init(base) but if and only if the precision has changed.
pentation.gp has all of the new minor changes from kneser.gp, included in it.

To use the program, you'll need to install pari-GP. After loading kneser.gp, to generate the sexp/tetration function for base e, type in "init(exp(1))". The program will loop and generate the xsexp/xtheta polynomials. Then type in sexp(z) for any complex valued z, and the program will return sexp(z). For example, sexp(1)=~2.71828...
- Sheldon
Reply
#37
Base<1 doesn't work yet!???
Reply
#38
Why is this called "Kneser"? can you provide the article or reference that inspired this algorithm?
Reply
#39
(01/14/2016, 12:59 AM)andydude Wrote: Why is this called "Kneser"? can you provide the article or reference that inspired this algorithm?

Take a look at these two posts; Henryk's post, http://math.eretrandre.org/tetrationforu...hp?tid=213
and Jay's post, http://math.eretrandre.org/tetrationforu...hp?tid=358

Kneser's Riemann mapping results in where which has been wrapped around a unit circle by using the substitution . So my approach is related, and mathematically equivalent, but not identical. In the approach used in my kneser.gp program, I iterate, generating increasingly accurate approximations from increasingly accurate sexp(z) taylor series approximations where in the limit,
- Sheldon
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  "Kneser"/Riemann mapping method code for *complex* bases mike3 2 4,109 08/15/2011, 03:14 PM
Last Post: Gottfried
  Attempt to make own implementation of "Kneser" algorithm: trouble mike3 9 9,298 06/16/2011, 11:48 AM
Last Post: mike3
  Numerical algorithm for Fourier continuum sum tetration theory mike3 12 12,062 09/18/2010, 04:12 AM
Last Post: mike3
  regular sexp: curve near h=-2 (h=-2 + eps*I) Gottfried 2 3,980 03/10/2010, 07:52 AM
Last Post: Gottfried
  Attempting to compute the kslog numerically (i.e., Kneser's construction) jaydfox 11 11,175 10/26/2009, 05:56 PM
Last Post: bo198214
  regular sexp:different fixpoints Gottfried 6 7,118 08/11/2009, 06:47 PM
Last Post: jaydfox
  sexp(strip) is winding around the fixed points Kouznetsov 8 7,862 06/29/2009, 10:05 AM
Last Post: bo198214
  sexp and slog at a microcalculator Kouznetsov 0 2,151 01/08/2009, 08:51 AM
Last Post: Kouznetsov



Users browsing this thread: 1 Guest(s)