[sage-support] Re: Straightforward calculation going wrong?

2011-05-03 Thread KvS
On May 3, 1:53 am, Dan Drake wrote: > On Mon, 02 May 2011 at 04:28PM -0700, KvS wrote: > > I am staring already for half an hour at the following. This piece of > > code: > > > reset() > > print 'Loop 1:' > > B=-2 > > for A in range(-3,-1): >

[sage-support] Straightforward calculation going wrong?

2011-05-02 Thread KvS
Dear all, I am staring already for half an hour at the following. This piece of code: reset() print 'Loop 1:' B=-2 for A in range(-3,-1): C=-A*B/(A+B) print "A:",A,"B:",B,"C:",C,"A*B+C*(A+B)=",A*B+C*(A+B) print 'Loop 2:' for A in range(-3,-1): for B in range(-3,-1): C=-A*B/(A

[sage-support] Re: Two equivalent ways of inputting a function involving gamma function yield different result?

2010-12-23 Thread KvS
On Dec 24, 12:29 am, Jason Grout wrote: > On 12/23/10 7:22 AM, Jason Grout wrote: > > > Definitely weird.  Apparently subtracting mygammaexpr from gamma(-x-1/2) > > makes mygammaexpr suddenly realize that it's okay to evaluate it at x=0. > > And lest we think the errors are something from Kees's i

[sage-support] Re: Weird *** longjmp causes uninitialized stack frame *** error?

2010-12-23 Thread KvS
On Dec 23, 11:25 pm, Volker Braun wrote: > My guess would be > > #8  0x008eef06 in rtodbl (x=0xb7d3d708) > > This is where the over flow occurs, raises signal > > #7  0x00b49f0e in pari_err (numerr=15) at ../src/language/init.c:980 > > it is handled by the pari error handler, which attempts to lon

[sage-support] Re: Weird *** longjmp causes uninitialized stack frame *** error?

2010-12-23 Thread KvS
On Dec 23, 10:17 pm, Volker Braun wrote: > I'm getting the somewhat expected result: > > sage: i=sqrt(-1) > sage: for k in range(100): > :         print k; r1=random(); r2=random() > :     try: > :             xx=100*r1-i; yy=100*r2 > :         res=gamma(xx)*gamma(yy)/gamma(xx+yy)

[sage-support] Weird *** longjmp causes uninitialized stack frame *** error?

2010-12-23 Thread KvS
Hi all, I'm very sorry, but I have yet another error I don't understand. I was playing around with evaluating the gamma function. The following piece of code is fine (on Sage v 4.6): i=sqrt(-1) for k in range(100): print k; r1=random(); r2=random() #try: #xx=100*r1-i; yy=100*r2

[sage-support] Re: Two equivalent ways of inputting a function involving gamma function yield different result?

2010-12-23 Thread KvS
On Dec 23, 6:42 pm, Jason Grout wrote: > On 12/23/10 1:02 AM, KvS wrote: > > > In addition to the previous post, if I change the contents of the > > first cell to > > > f=BetaLP1.getkthMomentAt(1,1) > > g=symbolic_expression(str(f(x))).function(x) > > print

[sage-support] Re: Two equivalent ways of inputting a function involving gamma function yield different result?

2010-12-23 Thread KvS
On Dec 23, 6:42 pm, Jason Grout wrote: > On 12/23/10 1:02 AM, KvS wrote: > > > In addition to the previous post, if I change the contents of the > > first cell to > > > f=BetaLP1.getkthMomentAt(1,1) > > g=symbolic_expression(str(f(x))).function(x) > > print

[sage-support] Re: Two equivalent ways of inputting a function involving gamma function yield different result?

2010-12-22 Thread KvS
In addition to the previous post, if I change the contents of the first cell to f=BetaLP1.getkthMomentAt(1,1) g=symbolic_expression(str(f(x))).function(x) print g(0) it does yield 1 as well. Any hints? Thanks, Kees -- To post to this group, send email to sage-support@googlegroups.com To unsubs

[sage-support] Two equivalent ways of inputting a function involving gamma function yield different result?

2010-12-22 Thread KvS
Hi all, I didn't know how to make the title any clearer, I'm sorry. The problem is as follows (on Sage v 4.6). Running the following piece of code (BetaLP1 is some class): f=BetaLP1.getkthMomentAt(1,1) print 'f:',f print f(0) yields the following error: f: x |--> e^(9/200*x^2 + 4/3*sqrt(pi)*gam

[sage-support] mpmath's incomplete gamma function evaluates much faster for small arguments

2010-11-27 Thread KvS
Dear all, just a quick question/remark, today I was working (plotting etc.) with some quantities that involve (upper) incomplete gamma functions. Some operations took very long, as it turned out due to the incomplete gamma function evaluating very slowly for small arguments. Some testing showed th

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-19 Thread KvS
On Sep 18, 7:10 pm, Thierry Dumont wrote: > Le 18/09/2010 16:31, KvS a �crit : > > > > > Hi again, > > > I hope you don't mind me bumping this thread one more time. I started > > experimenting with trying a few things for fast arbitrary precision >

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-18 Thread KvS
Hi again, I hope you don't mind me bumping this thread one more time. I started experimenting with trying a few things for fast arbitrary precision computations using Cython. Above it was suggested to use MPFR directly, so without the RealNumber wrapper, as the fastest way. Here is a bit of code t

[sage-support] Re: (5-e^x).substitute(x=log(x)) goes wrong?

2010-09-10 Thread KvS
Ok, thanks! On Sep 10, 8:55 pm, Burcin Erocal wrote: > Hi Kees, > > On Fri, 10 Sep 2010 08:10:45 -0700 (PDT) > > > > KvS wrote: > > Dear all, > > > I'm sorry I have yet again something to bother you with. Running the > > following few lines: &g

[sage-support] (5-e^x).substitute(x=log(x)) goes wrong?

2010-09-10 Thread KvS
Dear all, I'm sorry I have yet again something to bother you with. Running the following few lines: eq=5-e^x print "1:",eq.substitute(x=3*x) print "2:",eq.substitute(x=log(x)) yields the output (Sage 4.5.2 with Ubuntu): 1: -e^(3*x) + 5 2: -log(x) + 5 So 1 is fine, but it seems that to get to 2

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-09 Thread KvS
On Sep 9, 9:17 pm, Robert Bradshaw wrote: > On Thu, Sep 9, 2010 at 11:44 AM, KvS wrote: > > On Sep 9, 5:27 pm, Robert Bradshaw > > wrote: > >> On Wed, Sep 8, 2010 at 6:39 PM, KvS wrote: > >> > Thanks all, however I am not very successful so far :(. >

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-09 Thread KvS
On Sep 9, 5:27 pm, Robert Bradshaw wrote: > On Wed, Sep 8, 2010 at 6:39 PM, KvS wrote: > > Thanks all, however I am not very successful so far :(. > > > I tried both options mentioned before: > > > - only optimize the loops in Cython and keep using symbolic > &g

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-09 Thread KvS
On Sep 9, 5:27 pm, Robert Bradshaw wrote: > On Wed, Sep 8, 2010 at 6:39 PM, KvS wrote: > > Thanks all, however I am not very successful so far :(. > > > I tried both options mentioned before: > > > - only optimize the loops in Cython and keep using symbolic > &g

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-08 Thread KvS
Thanks all, however I am not very successful so far :(. I tried both options mentioned before: - only optimize the loops in Cython and keep using symbolic expressions/infinite precision, but this is unfortunately rather slow; - fully optimize in Cython by turning to doubles everywhere, although i

[sage-support] Re: Arbitrary precision in Cython & NumPy?

2010-09-08 Thread KvS
Thanks a lot for the hints so far, I will go and try them out. I'd still also be very interested if somebody could shed some more light on my original questions! Thanks, Kees -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage

[sage-support] Arbitrary precision in Cython & NumPy?

2010-09-08 Thread KvS
Dear all, I am trying to implement a recursive algorithm that is rather complex, in the sense that it uses a high number of variables and (elementary) computations. The output in Sage looks fine but it gets quite slow, so I am thinking of ways to speed it up. Given that it is mainly a lot of loopi

[sage-support] Re: Python expression to Cython function?

2010-07-23 Thread KvS
On Jul 24, 7:32 am, William Stein wrote: > On Fri, Jul 23, 2010 at 2:27 PM, KvS wrote: > > Dear all, > > > I'm sorry if this is a 'utfs' question, but I couldn't really find a > > clear answer. I would like to do some numerical operations on a Sage >

[sage-support] Python expression to Cython function?

2010-07-23 Thread KvS
Dear all, I'm sorry if this is a 'utfs' question, but I couldn't really find a clear answer. I would like to do some numerical operations on a Sage function (/expression) provided by the user (i.e. typed in the notebook). Ideally I would like to have this function available as a Cython function to

[sage-support] Re: Importing a Python module

2010-07-23 Thread KvS
On Jul 21, 2:34 am, Mike Hansen wrote: > On Tue, Jul 20, 2010 at 9:27 AM, KvS wrote: > > Thanks for the quick reply. I tried putting "from sage.all import *" > > Could you post the code tohttp://sage.pastebin.com.  It is better to > avoid using "import *" a

[sage-support] Re: Importing a Python module

2010-07-20 Thread KvS
On Jul 21, 2:34 am, Mike Hansen wrote: > On Tue, Jul 20, 2010 at 9:27 AM, KvS wrote: > > Thanks for the quick reply. I tried putting "from sage.all import *" > > Could you post the code tohttp://sage.pastebin.com.  It is better to > avoid using "import *" a

[sage-support] Re: Importing a Python module

2010-07-20 Thread KvS
On Jul 21, 2:34 am, Mike Hansen wrote: > On Tue, Jul 20, 2010 at 9:27 AM, KvS wrote: > > Thanks for the quick reply. I tried putting "from sage.all import *" > > Could you post the code tohttp://sage.pastebin.com.  It is better to > avoid using "import *" a

[sage-support] Re: Importing a Python module

2010-07-20 Thread KvS
On Jul 21, 2:01 am, Mike Hansen wrote: > On Tue, Jul 20, 2010 at 8:58 AM, KvS wrote: > > So I guess my problem is that I don't understand the namespaces > > involved somehow, since sgn() lives somewhere in a Sage namespace and > > importing doesn't place the

[sage-support] Importing a Python module

2010-07-20 Thread KvS
Dear all, I was trying to find a way to import code form a python file to my notebook (the reason is mainly to save long code in a different place as just a plain text file, and also to be able to work on the code in a Python editor). However, if I copy-paste working code from a notebook to an edi

[sage-support] Problem with typesetting of help in notebook?

2010-07-16 Thread KvS
Dear all, somehow the documentation you get by typing ? in a notebook cell seems messed up (in my case), Sage 4.4.4 on Ubuntu 10.04 with Firefox 3.6.6. Since a screenshot is probably worth a 1000 words, here goes: http://tweakers.net/ext/f/Cv8vuWWbGcYuy6u9IyfmKdWu/full.png. Any hints on what might

[sage-support] Re: How to properly define a 'Sage-function'?

2009-08-20 Thread KvS
On Aug 20, 4:28 am, Jason Grout wrote: > Robert Bradshaw wrote: > > > It's just syntactic sugar. > > To see what Sage transforms something like this into, you can use the > preparse function: > > sage: preparse('f(y,z)=y^2+z') > '__tmp__=var("y,z"); f = symbolic_expression(y**Integer(2)+z).functi

[sage-support] Re: How to properly define a 'Sage-function'?

2009-08-19 Thread KvS
On Aug 19, 11:06 pm, Robert Bradshaw wrote: > On Wed, 19 Aug 2009, KvS wrote: > > > Dear all, > > > just started exploring Sage (via sagenb.org), I'm very enthousiastic > > about the concept and am very eager to leave 'black box' Mathematica > >

[sage-support] How to properly define a 'Sage-function'?

2009-08-19 Thread KvS
Dear all, just started exploring Sage (via sagenb.org), I'm very enthousiastic about the concept and am very eager to leave 'black box' Mathematica asap. One issue however I can't seem to get my head around, namely what exactly is the 'right' way to think of and work with Sage- functions (as oppo