On 10/29/06, William Stein <[EMAIL PROTECTED]> wrote:
>
> On Sun, 29 Oct 2006 07:07:02 -0700, David Joyner <[EMAIL PROTECTED]>
> wrote:
>
> >
> > Hi:
> >
> > In preparing a patch to fix the bugs in special.py reported a
> > few days ago, I ran across the following odd feature:
> >
> > sage: f = lambda x: hypergeometric_U(1,1,x)
> > sage: f(0.1)
> > 2.0146425447084515
> > sage: f(0.2)
> > 1.4933487469322395
> > sage: f(0.9)
> > 0.63994922663929976
> > sage: P = plot(f,0.1,0.9)
> >
> > hangs. Computes values just fine (and quickly). Hangs when it
> > tries to plot.
> >
> > Can anyone explain this?
>
> Rewrite the function as
>
>   def f(x):
>       print x
>       return hypergeometric_U(1,1,x)
>
> then try again.  Then you can see what value causes the hang.
> Maybe something screwy happens when evaluating at a certain
> point.   Plotting evaluates at tons of points.


sage:   def f(x):
....:          print x
....:      return hypergeometric_U(1,1,x)
....:
sage: f(0.9)
0.90000000000000002
0.63994922663929976
sage: P = plot(f,0.1,0.9)
0.102283229454
0.10692936957
0.110930309744
0.114320531546
0.118342064214
0.123848394048
0.127724022752
0.128652686444
0.133432926216
0.138567533985
0.143004922499
0.145515511421
0.150407834394
0.15370284616
0.159522285957
0.162727517241
0.164596405605
0.1682601914
0.175307908786
0.179629582659
0.182499423897
0.187251690758
0.191961241497
0.195330388426
0.197608343887
0.200782180757
0.207609589926
0.210299483803
0.215628024551
0.216397313632
0.222330488694
0.226062692224
0.228634545576
0.235742245511
0.239640782184

This is where it hangs. If I just try to plot the function directly
then it immediately
fails witha PariError:

sage: P = plot(hypergeometric_U(1.0,1.0,x),0.1,0.9)
---------------------------------------------------------------------------
<class 'gen.PariError'>                   Traceback (most recent call last)

/mnt/hd200/sagefiles/sage-1.4.1/<ipython console> in <module>()

/home/wdj/sagefiles/sage-1.4.1/local/lib/python2.5/site-packages/sage/functions/special.py
in hypergeometric_U(alpha, beta, x, prec)
    551     from sage.libs.pari.all import pari
    552     R,a = _setup(prec)
--> 553     b = R(pari(alpha).hyperu(beta,x))
    554     pari.set_real_precision(a)
    555     return b

/mnt/hd200/sagefiles/sage-1.4.1/gen.pyx in gen._pari_trap()

<class 'gen.PariError'>: incorrect type (20)


Do you know what this means?

>
> Incidentally, for all your maxima-wrapped special functions,
> it would be good to make them classes with a plot method, e.g.,
>
>     def plot(....)

Okay, I'll try this.

>
> then the evaluation of the function at all points at which we
> want to evaluate it could be done via one maxima call (though,
> there could be no adaptive refinement, unless one wrote the code
> for that in Maxima, which one should do, I suppose).
>
> William
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to