Re: [sage-devel] question about calculus/riemann.pyx extension
Note that fs in the example is a list of length 1. David snip which suggests that fs should instead be an array. If I try to go through the steps of the initialization process by hand using the data from the test I get error messages: sage: import sage.calculus.riemann sage: fs = lambda t: e^(I*t) - 0.5*e^(-I*t) sage: fs[0] - -- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: 'function' object is unsubscriptable sage: len(fs) - -- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: object of type 'function' has no len() Nice idea but in practise I get the type error above. Is it a difference between cython and python? Francois -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] question about calculus/riemann.pyx extension
On Tue, Oct 26, 2010 at 04:03, François Bissey f.r.bis...@massey.ac.nzwrote: Note that fs in the example is a list of length 1. David snip which suggests that fs should instead be an array. If I try to go through the steps of the initialization process by hand using the data from the test I get error messages: sage: import sage.calculus.riemann sage: fs = lambda t: e^(I*t) - 0.5*e^(-I*t) sage: fs[0] - -- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: 'function' object is unsubscriptable sage: len(fs) - -- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: object of type 'function' has no len() Nice idea but in practise I get the type error above. Is it a difference between cython and python? You're doing sage: import sage.calculus.riemann sage: fs = lambda t: e^(I*t) - 0.5*e^(-I*t) sage: fs[0] Instead you should be doing sage: import sage.calculus.riemann sage: fs = [lambda t: e^(I*t) - 0.5*e^(-I*t)] sage: fs[0] Francois -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.comsage-devel%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] question about calculus/riemann.pyx extension
Hi, I am looking at the code and tests for the class Riemann_Map in calculus/riemann.pyx and I have a hard time understanding how it can be working at all. The init method starts with: def __init__(self, fs, fprimes, a, int N=500, int ncorners=4, opp=False): Initializes the ``Riemann_Map`` class. See the class ``Riemann_Map`` for full documentation on the input of this initialization method. TESTS:: sage: m = Riemann_Map([lambda t: e^(I*t) - 0.5*e^(-I*t)], [lambda t: I*e^(I*t) + 0.5*I*e^(-I*t)], 0) # long time (4 sec) -- so basically fs is a complex function and fprimes is its derivative and the test included (as well as some other in the riemann.pyx and interpolators.pyx files) shows that perfectly. fs is given as a lambda function and in some tests fprimes is explicitly defined as its derivative. Then in the code of the init method we have: self.f = fs[0] and later self.B = len(fs) # number of boundaries of the figure which suggests that fs should instead be an array. If I try to go through the steps of the initialization process by hand using the data from the test I get error messages: sage: import sage.calculus.riemann sage: fs = lambda t: e^(I*t) - 0.5*e^(-I*t) sage: fs[0] --- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: 'function' object is unsubscriptable sage: len(fs) --- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: object of type 'function' has no len() Anyone can enlighten me on this matter? Francois -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
Re: [sage-devel] question about calculus/riemann.pyx extension
Note that fs in the example is a list of length 1. David On Mon, Oct 25, 2010 at 23:14, François Bissey f.r.bis...@massey.ac.nzwrote: Hi, I am looking at the code and tests for the class Riemann_Map in calculus/riemann.pyx and I have a hard time understanding how it can be working at all. The init method starts with: def __init__(self, fs, fprimes, a, int N=500, int ncorners=4, opp=False): Initializes the ``Riemann_Map`` class. See the class ``Riemann_Map`` for full documentation on the input of this initialization method. TESTS:: sage: m = Riemann_Map([lambda t: e^(I*t) - 0.5*e^(-I*t)], [lambda t: I*e^(I*t) + 0.5*I*e^(-I*t)], 0) # long time (4 sec) -- so basically fs is a complex function and fprimes is its derivative and the test included (as well as some other in the riemann.pyx and interpolators.pyx files) shows that perfectly. fs is given as a lambda function and in some tests fprimes is explicitly defined as its derivative. Then in the code of the init method we have: self.f = fs[0] and later self.B = len(fs) # number of boundaries of the figure which suggests that fs should instead be an array. If I try to go through the steps of the initialization process by hand using the data from the test I get error messages: sage: import sage.calculus.riemann sage: fs = lambda t: e^(I*t) - 0.5*e^(-I*t) sage: fs[0] --- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: 'function' object is unsubscriptable sage: len(fs) --- TypeError Traceback (most recent call last) /home/francois/ipython console in module() TypeError: object of type 'function' has no len() Anyone can enlighten me on this matter? Francois -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.comsage-devel%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org