04/23/2008, 10:34 PM
I have learned alot about Sage by building this library. For example, in my implementation of parabolic iteration, I used "SymbolicVariable" to make a new variable, where I have since learned that Sage makes a simpler function available for this, namely "var" so you can do "t = var('t')" instead. I have also learned that every Sage module has a sub-module called "all" which allows you to import the most commonly used functions from that package at the same time. So where I used to do:
now I use
which is a quick-and-dirty way to make all of Sage available when making a new Python module. I have also learned the difference between ".sage" and ".py" files, in that ".sage" and ".sobj" files are loaded with "load('filename.sage')" whereas ".py" files are loaded with "import filename". So instead of naming my files with ".sage" I will be naming them with ".py" so they can be used with the Python module system. So far I have finalized two files so far, and while I'm still working on the other files, I think there is enough to start using.
The 2 files I have available so far are "hyper/special/matrix.py" and "hyper/polynomial.py" which I have attached. I am very close to finishing matrix exp, log, and power, but I need help with the implementation. I see that the methods discussed in this thread talk about 2 methods of calculating matrix log and I'm still wondering which is better.
To use these, or try them out, just put the "hyper" directory in the directory you are going to be running sage. So if you run sage in "/home/me" then you should see "/home/me/hyper/" before you run Sage. You can type the following at the Sage prompt:
You can test to see if its working by just making a parabolic function. The coefficients are pre-declared as symbolic variables in Sage, so you don't have to make your own. You can now test The Bell matrix with this:
Have Fun! Also, if you want to learn which functions are in this package, since it is obviously going to be growing (or learn about Sage!) is to do something like this:
this will give you a listing of all of the functions in that module.
@Gottfried
I think it would also be nice to write two more functions for your use, namely V = Vandermonde_vector() and Vandermonde_matrix(), but I haven't done this yet...
@Henryk
I agree with all of your points. I will do it in Sage.
Andrew Robbins
Code:
from sage.calculus.calculus import SymbolicVariableCode:
from sage.all import *The 2 files I have available so far are "hyper/special/matrix.py" and "hyper/polynomial.py" which I have attached. I am very close to finishing matrix exp, log, and power, but I need help with the implementation. I see that the methods discussed in this thread talk about 2 methods of calculating matrix log and I'm still wondering which is better.
To use these, or try them out, just put the "hyper" directory in the directory you are going to be running sage. So if you run sage in "/home/me" then you should see "/home/me/hyper/" before you run Sage. You can type the following at the Sage prompt:
Code:
sage: from hyper.all import *
sage: p_poly(x)
x^5*C5 + x^4*C4 + x^3*C3 + x^2*C2 + xCode:
sage: Bell_matrix(p_poly(x), x)
[ 1 0 0 0 0 0]
[ 0 1 0 0 0 0]
[ 0 C2 1 0 0 0]
[ 0 C3 2*C2 1 0 0]
[ 0 C4 2*C3 + C2^2 3*C2 1 0]
[ 0 C5 2*C4 + 2*C2*C3 3*C3 + 3*C2^2 4*C2 1]
sage: Bell_matrix(exp(x) - 1, x, n_row=6)
[ 1 0 0 0 0 0 0]
[ 0 1 0 0 0 0 0]
[ 0 1/2 1 0 0 0 0]
[ 0 1/6 1 1 0 0 0]
[ 0 1/24 7/12 3/2 1 0 0]
[ 0 1/120 1/4 5/4 2 1 0]
[ 0 1/720 31/360 3/4 13/6 5/2 1]
sage: Carleman_matrix(x + 1, x, n_row=8)
[ 1 0 0 0 0 0 0 0 0]
[ 1 1 0 0 0 0 0 0 0]
[ 1 2 1 0 0 0 0 0 0]
[ 1 3 3 1 0 0 0 0 0]
[ 1 4 6 4 1 0 0 0 0]
[ 1 5 10 10 5 1 0 0 0]
[ 1 6 15 20 15 6 1 0 0]
[ 1 7 21 35 35 21 7 1 0]
[ 1 8 28 56 70 56 28 8 1]Have Fun! Also, if you want to learn which functions are in this package, since it is obviously going to be growing (or learn about Sage!) is to do something like this:
Code:
sage: import hyper.all
sage: dir(hyper.all)@Gottfried
I think it would also be nice to write two more functions for your use, namely V = Vandermonde_vector() and Vandermonde_matrix(), but I haven't done this yet...
@Henryk
I agree with all of your points. I will do it in Sage.
Andrew Robbins

