Or:
sage: import sage.libs.mpmath.all as mpmath
sage: V=mpmath.call(mpmath.legenp,2.1,0,-2);V
5.83105230126368 + 1.89579005740338*I
sage: type(V)
On 13 Kwi, 23:45, Fredrik Johansson
wrote:
> On Apr 13, 7:48 pm, ObsessiveMathsFreak
>
>
>
> wrote:
> > On Apr 12, 8:52 pm, ObsessiveMathsFreak
>
> >
On Apr 13, 7:48 pm, ObsessiveMathsFreak
wrote:
> On Apr 12, 8:52 pm, ObsessiveMathsFreak
>
> wrote:
> > On Apr 12, 3:51 am, kcrisman wrote:
>
> > > > > Or simply legendre_P, legendre_Q
>
> > > > Unfortunately, these functions do not support non integer values of n,
> > > > i.e. they don't suppor
Is your function usable?
def mplegp(n,m,x):
V=mpmath.legenp(n,m,x)
return float(V.real)+I*float(V.imag)
sage: time plot(lambda x:mplegp(2.1,0,x).real(),(x,-1,1))
CPU times: user 0.87 s, sys: 0.00 s, total: 0.87 s
Wall time: 0.87 s
On 13 Kwi, 19:48, ObsessiveMathsFreak
wrote:
> On Apr 12, 8:5
On Apr 12, 8:52 pm, ObsessiveMathsFreak
wrote:
> On Apr 12, 3:51 am, kcrisman wrote:
>
> > > > Or simply legendre_P, legendre_Q
>
> > > Unfortunately, these functions do not support non integer values of n,
> > > i.e. they don't support generalised legendre functions, which is what
> > > I need
Maxima functions are OK
but mpmath is not as slow as one can think
sage: time list_plot([(x,mpmath.legenq(2,0,x)) for x in
srange(-0.99,1.01,0.05)],plotjoined=True)
+list_plot([(x,mpmath.legenp(2,0,x)) for x in
srange(-0.99,1.01,0.1)],plotjoined=True)
CPU times: user 0.20 s, sys: 0.00 s, total: 0.2
On Apr 12, 3:51 am, kcrisman wrote:
> > > Or simply legendre_P, legendre_Q
>
> > Unfortunately, these functions do not support non integer values of n,
> > i.e. they don't support generalised legendre functions, which is what
> > I need.
>
> Are gen_legendre_P and gen_legendre_Q okay? These are a
> > Or simply legendre_P, legendre_Q
>
> Unfortunately, these functions do not support non integer values of n,
> i.e. they don't support generalised legendre functions, which is what
> I need.
Are gen_legendre_P and gen_legendre_Q okay? These are all used from
Maxima, as I recall.
- kcrisman
sage: reset()
sage: import mpmath
sage: plot(lambda x: mpmath.legenp(2,0,x),(x,-1,1))
On 11 Kwi, 00:34, achrzesz wrote:
> Workaround:
> list_plot([(x,legenp(2,0,x)) for x in
> srange(-1,1,0.1)],plotjoined=True)
> On 10 Kwi, 23:47, ObsessiveMathsFreak
> wrote:
>
> > The mpmath import seems to work
Workaround:
list_plot([(x,legenp(2,0,x)) for x in
srange(-1,1,0.1)],plotjoined=True)
On 10 Kwi, 23:47, ObsessiveMathsFreak
wrote:
> The mpmath import seems to work, but I am unable to plot the resulting
> functions. I get an error about too many values to unpack.
>
> from mpmath import *
>
> plot(
The mpmath import seems to work, but I am unable to plot the resulting
functions. I get an error about too many values to unpack.
from mpmath import *
plot(lambda x: legenp(1,0,x),(x,-1,1))
Traceback (click to the left of this block for traceback)
...
ValueError: too many values to unpack
On Ap
Or simply legendre_P, legendre_Q
On 10 Kwi, 21:26, achrzesz wrote:
> Or:
> sage: import scipy.special
> sage: scipy.special.legendre(1,0.5)
> poly1d([ 1., 0.])
> sage: scipy.special.lqn(int(1),float(0.5))
> (array([ 0.54930614, -0.72534693]), array([ 1., 1.21597281]))
>
> On 10 Kwi, 20:
Or:
sage: import scipy.special
sage: scipy.special.legendre(1,0.5)
poly1d([ 1., 0.])
sage: scipy.special.lqn(int(1),float(0.5))
(array([ 0.54930614, -0.72534693]), array([ 1., 1.21597281]))
On 10 Kwi, 20:17, ObsessiveMathsFreak
wrote:
> Ugghh It looks like scipy wasn't quite what I
On Sun, Apr 10, 2011 at 11:17 AM, ObsessiveMathsFreak
wrote:
> Ugghh It looks like scipy wasn't quite what I was looking for. All
> I really need is a way of evaluating generalised legendre functions of
> the first and second kind. I've actually found a package in sympy that
> does this
>
> ht
If numerical tools are sufficient then:
sage: from mpmath import *
sage: mp.dps = 15; mp.pretty = True
sage: legendre(1,0.5)
0.5
sage: legenq(1,0,0.5)
-0.725346927832973
On 10 Kwi, 20:17, ObsessiveMathsFreak
wrote:
> Ugghh It looks like scipy wasn't quite what I was looking for. All
> I reall
Ugghh It looks like scipy wasn't quite what I was looking for. All
I really need is a way of evaluating generalised legendre functions of
the first and second kind. I've actually found a package in sympy that
does this
http://docs.sympy.org/dev/modules/mpmath/functions/orthogonal.html#mpmath.l
15 matches
Mail list logo