05/10/2008, 09:16 AM (This post was last modified: 05/10/2008, 09:17 AM by bo198214.)
Andrew, I am looking for ways for efficiently working together.
I would like to provide the regular iteration things, as I have the most experience with them here on the forum.
I think there is a lot to discuss, perhaps mainly about naming, dividing into packages and how to handle bugs of sage, etc. So
1. we need a communication channel. Perhaps skype, googletalk, ICQ, YIM, MSN, etc? and roughly times when we are available for discussing the tetration library. I am per default available via skype and google talk.
Then we have to keep track of a common code
2. we need a common repository. I worked a lot with subversion, however it is said that the repository git developed by Torwalds for the Linux kernel is more sophisticated. Has anyone experiences with it?
We also need a server to run it.
So then I would like to start the naming discussion, with how the tetration library shall be called? I mean it surely shall not be just about tetration. It should include all the hyperoperations of different kind and also the methods for non-integer iteration of functions.
So I would propose the name HyperOp. However I am not familiar with typical naming in Sage (to be honest i am an absolute novice to sage).
05/16/2008, 12:58 AM (This post was last modified: 05/16/2008, 01:14 AM by andydude.)
Well, I've included an algorithm for hyperbolic iteration (the more general "complement" of parabolic iteration, where \( f(0) = 0 \) and \( f'(0) \ne 1 \)). However, I was hoping to make it general enough to include an implementation of matrix_exp and matrix_log at the same time, but I do not have working alorithms for these yet (but thanks to Gottfried we do, just in a different language). The matrix power code for hyperbolic iteration is very specific to triangular matrices, so I'm not sure how well it could be generalized to arbitrary matrices.
I found that the Sage built-in exp will only work on numeric matrices, and that the .left_eigenvectors() and .right_eigenvectors() methods are only defined on numeric matrices as well. The .eigenvalues() method, however, IS defined on symbolic matrices, but we don't need the eigenvalues (which are \( (1, f_1, f_1^2, f_1^3, \cdots) \)) so this is of no help. One of the purposes of this library is to investigate the symbolic case, which means I had to implement my own eigensystem decomposition algorithm. I checked that it produces the same result as it should in Mathematica, so at least we are being consistent.
I would very much like to work together! It would also help the project be more robust with more eyes making sure the code is right
I have a crappy server with a dynamic IP, but I think we would need one with a static IP to be more reliable. "HyperOp" is a good name for a library, but I was thinking "HyperSage". What do you think?
Now that both basic parabolic and hyperbolic methods are fleshed out, I'm not going to work much more on them. There is also a regular iteration sub-module, but the only stuff that would go here is Daniel Geisler's summation method, which I don't understand very well. Since most of regular iteration is working (parabolic/hyperbolic), I'm going to start working on the natural iteration sub-module.
andydude Wrote:I would very much like to work together! It would also help the project be more robust with more eyes making sure the code is right
I have a crappy server with a dynamic IP, but I think we would need one with a static IP to be more reliable.
I could provide my static IP at my office-pc. I have Windows running, can implement html,ftp via xitami-server and news/mail via hamster. Also I could implement some specific cgi-program. (If there are other free, reliable components running on Win98/128 MB I could install them, too)
andydude Wrote:Well, I've included an algorithm for hyperbolic iteration (the more general "complement" of parabolic iteration,
At least one person works at the tetration library ... I didnt even found the time to look through your code, but it will happen
But (!) I now have Sage actually working on my new Linux machine!
Though I found out that Sage has only support for truncated powerseries.
In Maple you could define a powerseries by a function that returns for each index the coefficient, and then apply various operations on powerseries like exponentation, composition, multiplication, addition, etc (though they were sometimes very slow ...).
Cool would also be a lazy evaluation ala Haskell, which unsurprisingly has a power series module, lazy evaluation seems just to be made for power series operations.
Quote:The matrix power code for hyperbolic iteration is very specific to triangular matrices, so I'm not sure how well it could be generalized to arbitrary matrices.
The method is generally known as Matrix function and better described at Jordan matrix. In our case the function is just the power \( x^t \).
In the matrix function article there is also mentioned a method via the Cauchy integral. I wonder whether this is a link (equality?) between Kouznetsov's method and the diagonalization method.
More useful for implementing the matrix power - without needing to perform an actual diagonalization - is Aldrovandi's explanation featured by Gottfried here.
In Maple everything is already there. You just can apply any function to matrices and you have even a specialized function Matrixpower.
Quote:I found that the Sage built-in exp will only work on numeric matrices, and that the .left_eigenvectors() and .right_eigenvectors() methods are only defined on numeric matrices as well.
Usually you have symbolic eigenvalues only up to 3 or 4. Because they are the solutions of the characteristic polynomial. I guess there are only a few occasions where symbolic eigenvalues make sense.
Quote:I would very much like to work together! It would also help the project be more robust with more eyes making sure the code is right
I have a look at it soon. Btw I would really be keen on having a public git project here or here or here. How about registering one?
05/16/2008, 07:27 PM (This post was last modified: 05/16/2008, 08:30 PM by bo198214.)
Ok, I now created a public git repository, having Andrew's sources checked in.
Its on github, you can find it here.
The public git url is:
git://github.com/bo198214/hyperops.git
So what do you have to do:
Install git if not done already,
Read about git basics here if not done already. And do those
Code:
$ git config --global user.name "Your Name Comes Here"
$ git config --global user.email you@yourdomain.example.com
go to the directory where you store your projects and then do
Code:
git clone git://github.com/bo198214/hyperops.git
This creates the directory 'hyperops' with all the sources that Andrew just provided contained.
You can locally work on it with 'git commit', 'git branch' , 'git merge' etc.
Give me your public ssh-key if you want to make changes/contribute to the code. It is found in: .ssh/id_rsa.pub or .ssh/id_dsa.pub. If unsure perhaps first read this
I ll add it to the repository and then you can write back your local changes via 'git push'.
thats it, have fun
Edit: changed hyperop to hyperops as this obeys the Sage recommendations
05/18/2008, 03:15 PM (This post was last modified: 05/18/2008, 03:30 PM by bo198214.)
Ok, here are my results of learning python and sage via implementing a proper powerseries module "hyperops.powerseries". I didnt dare to already incorporate it into our git repository before consilidating and synchronizing us about it. So I just attach the single file.
I also have a Sage question: How does one incorporate own packages into the sage hierarchy so that they are recognized from whatever path one starts sage?
Ok, now the module description:
The main difference to the existing powerseries package is that we deal with untruncated powerseries, which are evaluated as soon as we request it.
A powerseries is mainly given as a function that returns the coefficient for the index, i.e. what we write often as \( f_n \), the \( n \)-th coefficient of the powerseries \( f \).
Maple has such a package however its awfully slow if one want to compute for example hyperbolic iteration, because it lacks caching. This is a simple mechanism that just stores a once computed value for subsequent access. It is life-saving in the case of recursive computations as we need to do.
There are also other ugly matters with the Maple powerseries, for example that they always need a name. When created anonymously one get errors.
So thatswhy I was burning to create a proper powerseries package without all those drawbacks. And found that python is an absolute nice language to perform such tasks including functional programming style. And before long explanations I just give the example code, which is also included in the documentation section of the module.
Our beloved regular iteration is of course contained (hyperbolic and parabolic gathered in one routine deciding by the first coefficient which one to chose) and demonstrated here with the decremented exponential.
sage: #you can initialize power series with arbitrary functions on natural numbers
sage: #for example the power series of sqrt(2)^x can be given as
sage: bsrt = PowerSeriesI(lambda n: diff(sqrt(2)^x,x,n)(x=0)/factorial(n))
sage: #making the first coefficient 0 to get the decremented exponential
sage: def coeff(n):
sage: if n == 0:
sage: return 0
sage: else:
sage: return bsrt(n)
sage: dbsrt = PowerSeriesI(coeff)
sage: #and now starting hyperbolic iteration
sage: dbsrt2 = dbsrt.iterate(x).iterate(1/x)
sage: #Sage is not able to simplify
sage: simplify(dbsrt2(3))
...
sage: #but numerically we can verify equality
sage: RR(dbsrt2(3)(x=0.73)-dbsrt(3))
-8.67361737988404e-19
The pure command file (without the outputs) is appended. You can just paste into sage.
05/18/2008, 04:25 PM (This post was last modified: 05/18/2008, 04:37 PM by bo198214.)
Wah I found this site sage notebook. There you can online interactively work with sage on the server and publish your notebooks so that everyone can reproduce your results.
I just took the chance, invested some work and made the powerseries implementation into an online notebook accessible for everyone:
PS: Naturally the site is sometimes somewhat slow so dont be impatient
EDIT: Oh I just see that you cant test the script as visitor, you have to create an own account and I have to add you into the collaborators list ... hm
Wow! Nice power series package! I just looked at the .py file, and I noticed a few things:
(1) Several methods are missing underscores (for example _repr_ should be __repr__)
(2) Your inverse() method is empty, but I have implemented series_inverse() already, so we can use this.
05/18/2008, 09:44 PM (This post was last modified: 05/18/2008, 10:03 PM by andydude.)
@Henryk
I just read your implementation for parabolic and hyperbolic iteration, and I recognize that you are using Jabotinsky's formula for the parabolic case, but for the hyperbolic case, you seem to be using a method I've never seen before. Embedded in your implementation is the implicit recurrence equation:
andydude Wrote:but for the hyperbolic case, you seem to be using a method I've never seen before. Embedded in your implementation is the implicit recurrence equation:
I described it here. The principle \( f^{\circ t} \circ f=f\circ f^{\circ t} \) with \( {f^{\circ t}}_1={f_1}^t \) is common in the regular iteration literature, however the formula is perhaps too dirty that I have seen it explicitely mentioned.
Quote:(1) Several methods are missing underscores (for example _repr_ should be __repr__)
You can read it in the sage package guidelines somewhere that you should use the sage specific _repr_ so that the user has the possibility to redefine __repr__
Quote:(2) Your inverse() method is empty, but I have implemented series_inverse() already, so we can use this.
Yes, the nice thing about the (hyp,par) iterate method is, that it is universally also applicable for exponent (-1). So the inverse function is just a wrapper for iterate(-1).
However perhaps in the future I will also include the direct formulas, for example to take the compositional root, you can easily derive an iterative formula solving \( f^{\circ n} = g \) for \( f \). Though the result should be the same as if you just do \( g^{\circ 1/n} \) vie the regular iteration. I also plan to implement the power \( f^{x} \) for arbitrary \( x \) and not just for integers as it is now.
Originally I wanted to use "^" via __and__ for the iteration, like I used "**" via __pow__ for the powers. Do you have an idea why this is not recognized? And also the question about how to put the hyperops package into sage that it is automatically recognized is still open for me.