[sage-support] Re: Will Sage run on a 4GB Asus Eee PC?

2008-05-11 Thread achrzesz
On 9 Maj, 20:27, "David Joyner" <[EMAIL PROTECTED]> wrote: > It turns out that next year it is very possible that all USNA freshamn will > have > an asus eee. The debate seems to be about the amount of ram it should have. > I can borrow one next week. It has xandros linux 500M ram, 2G "hard > d

[sage-support] sage ecm-interface

2008-12-16 Thread achrzesz
Hallo, I'm wondering what goes wrong with tis: (sage 3.2 compiled from sources, ubuntu 8.04, quad core 2.4 GHz) sage: for k in range(14,21): : f=2^2^k+1;w=ecm.find_factor(f);[w[0],prod(w)==f] : [2, False] [523923, False] [1901173, False] [2, False] [2, False] [30539, False] [2, Fal

[sage-support] Re: sage ecm-interface

2008-12-16 Thread achrzesz
The old fashioned gmp-ecm interface: sage: ecm.find_factor(2^2^7+1) [59649589127497217, 5704689200685129054721] sage: ecm.get_last_params() {'B1': '19929', 'B2': '3804582', 'poly': 'x^1', 'sigma': '1643647236'} the proposed, new one: sage: import sage.libs.libecm sage: from sage.libs.libecm impo

[sage-support] associativity of addition on ell. curves

2008-01-09 Thread achrzesz
Hello My question is connected with file http://modular.fas.harvard.edu/ent/ent_py and especially with checking the associativity law of addition on ell. curves. When I was trying to perform the same calculations in Sage I observed some surprising (me) behaviour. Enclosed is the corresponding Sa

[sage-support] Re: associativity of addition on ell. curves

2008-01-10 Thread achrzesz
Thanks to John Cremona and Paul Zimmermann I'm impressed, I didn't expect such quick response from leading specialists in the field. Thank you very much! The answers were extremly interesting an concrete but I can't agree with last John Cremona's statement: "we have answered the original question!

[sage-support] Re: associativity of addition on ell. curves

2008-01-12 Thread achrzesz
Paul Im impressed again. Thank you so much I had only a rough idea and you are realy effective in SAGE (too). This time I have no additional concrete questions but I'm strongly interested in your general opinion concerning the comparison MAPLE-SAGE (any links?) Andrzej Chrzeszczyk On 11 Sty, 23:

[sage-support] Re: associativity of addition on ell. curves

2008-01-12 Thread achrzesz
Paul Have you noticed that your SAGE code is much faster tha MAPLE's? Your final questions are interesting but not easy to me Andrzej Chrzeszczyk On 12 Sty, 16:27, achrzesz <[EMAIL PROTECTED]> wrote: > Paul > Im impressed again. Thank you so much > I had only a rough id

[sage-support] Re: associativity of addition on ell. curves

2008-01-12 Thread achrzesz
If you dont want factor you can use n12 = numerator((s1-s2).rational_simplify()) On 12 Sty, 16:53, achrzesz <[EMAIL PROTECTED]> wrote: > Paul > Have you noticed that your SAGE code is much faster tha MAPLE's? > Your final questions are interesting but not easy to me > And

[sage-support] Re: associativity of addition on ell. curves

2008-01-12 Thread achrzesz
Sty, 21:57, achrzesz <[EMAIL PROTECTED]> wrote: > If you dont want factor you can use > n12 = numerator((s1-s2).rational_simplify()) > > On 12 Sty, 16:53, achrzesz <[EMAIL PROTECTED]> wrote: > > > Paul > > Have you noticed that your SAGE code is much faster tha MAPL

[sage-support] Re: associativity of addition on ell. curves

2008-01-15 Thread achrzesz
Dear Carl, I like your code; it is elegant and realy quick but it seems that finishing your code with Paul Zimmermann's approach I2 = singular(I).groebner() #print I.reduce(n12); print singular.reduce((n12), I2) (althout less elegant) is a little bit faster (0.06 -> 0.05 on my comp. :) I want a

[sage-support] Re: associativity of addition on ell. curves

2008-01-16 Thread achrzesz
over Fraction Field of Multivariate Polynomial Ring in a, b, x1, x2, x3 over Rational Field by the ideal (y1^2 - x1^3 - a*x1 - b, y2^2 - x2^3 - a*x2 - b, y3^2 - x3^3 - a*x3 - b) but E = EllipticCurve(S, [a,b]) does not work (in the present implementation) Andrzej On 15 Sty, 08:35, achrze

[sage-support] Re: Integration

2011-02-08 Thread achrzesz
One can also use scipy (faster) or mpmath (very slow) sage: import scipy.integrate sage: scipy.integrate.dblquad(lambda x,y:abs(cos(x+y)),0,pi,lambda x: 0,lambda x:pi) (6.2831850310568189, 8.0696816340264377e-08) sage: n(2*pi) 6.28318530717959 sage: from mpmath import * sage: mp.dps = 50; mp.pre

[sage-support] What's wrong with solve or n() ?

2011-02-08 Thread achrzesz
sage: s=solve(3*x^3-9*x+10,x,solution_dict=True) sage: ns=[n(s[k][x]) for k in range(3)] sage: ns [1.06780542232902 - 1.84949324407141*I, 0.0277635108030695 + 1.24902476648341*I, -1.09556893313209 + 0.600468477588001*I] # no real solution, no conjugate solutions sage: x=CC[x].0 sage:

[sage-support] Re: What's wrong with solve or n() ?

2011-02-10 Thread achrzesz
Thank you for explanation Francois Note however that the additional option can change Maxima's behavior sage: s=solve(3*x^3-9*x +10==0,x,solution_dict=True,to_poly_solve='force') sage: [n(t[x]) for t in s] [1.06780542232902 - 0.648556288895405*I, # -2.13561076604555, # POOR PRECISION 1.067805

[sage-support] Problem with solve() - n() -- not on maxima side

2011-02-21 Thread achrzesz
SAGE: sage: s=solve(3*x^3-9*x+10==0,x,solution_dict=True) sage: [n(t[x]) for t in s] [1.06780542232902 - 1.84949324407141*I, 0.0277635108030695 + 1.24902476648341*I, -1.09556893313209 + 0.600468477588001*I] # WRONG! sage: s=solve(3*x^3-9*x+10==0,x, solution_dict=True,to_poly_solve='force') sage

[sage-support] Re: Problem integrating piecewise linear function (breaks with constant piece)

2011-02-21 Thread achrzesz
sage: f0(x) = 0 sage: f = Piecewise([[(0,1),f0]]) sage: numerical_integral(f,0,1) (0.0, 0.0) Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, v

[sage-support] Re: Problem integrating piecewise linear function (breaks with constant piece)

2011-02-22 Thread achrzesz
Naive work-around sage: [SR(0).integral(x,0,1),SR(1).integral(x,1,2),SR(2*x).integral(x, 2,3)] [0, 1, 5] sage: sum(_) 6 Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.

[sage-support] Re: Problem integrating piecewise linear function (breaks with constant piece)

2011-02-22 Thread achrzesz
Less naive (?) workaround def piecewise_lin_int(list_of_functions): li=[SR(y[0]).integral(x,y[1],y[2]) for y in list_of_functions] return sum(li) print piecewise_lin_int([[0,0,1],[1,1,2],[2*x,2,3]]) Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.co

[sage-support] Re: Problem integrating piecewise linear function (breaks with constant piece)

2011-02-22 Thread achrzesz
def piecewise_lin_int(list_of_functions): li=[SR(y[0]).integral(x,y[1],y[2]) for y in list_of_functions] return sum(li) #Example print piecewise_lin_int([[0,0,1],[1,1,2],[2*x,2,3]]) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send ema

[sage-support] Re: Unhelpful error message

2011-03-02 Thread achrzesz
| Sage Version 4.6.2, Release Date: 2011-02-25 | | Type notebook() for the GUI, and license() for information.| -- sage: inverse_mod(2,990) -

[sage-support] Re: Unhelpful error message

2011-03-02 Thread achrzesz
I'm not sure if this is relevant but sage: power_mod(2,-1,990) also gives helpful error message and checking for exponent -1 is not necessary A Ch -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegr

[sage-support] Re: how to simplify 3*x^2*y*z + x*y*z + y*z == 0 to 3*x^2 + x + 1 == 0 ?

2011-03-16 Thread achrzesz
Just for Fun sage: maxima('factor(3*x^2*y*z + x*y*z + y*z = 0)/(y*z)') 3*x^2+x+1=0 -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.

[sage-support] Re: converting expression with real coefficient to rational coefficient

2011-03-17 Thread achrzesz
Also: sage: s=SR(result) sage: type(s) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www

[sage-support] Re: phase portrait with sage.

2011-03-20 Thread achrzesz
import scipy.integrate import matplotlib.pyplot as plt import numpy a=1.0 b=2.0 def fun(t): if t<=-b: return -a elif fhttp://groups.google.com/group/sage-support URL: http://www.sagemath.org

[sage-support] Re: phase portrait with sage.

2011-03-21 Thread achrzesz
Of course N=100 in "my" code and repeated x0=[[0.5*k,0.5*k] for k in range(-10,10)] in Marshall one are superfluous :) Andrzej Chrzeszczyk On 21 Mar, 13:58, kcrisman wrote: > On Mar 20, 9:55 pm, Marshall Hampton wrote: > > > > > Slightly more Sage-ified version of the above very nice solution

[sage-support] Re: phase portrait with sage.

2011-03-21 Thread achrzesz
Also introducing lambda function wasn't necessary: import scipy.integrate a=1.0 b=2.0 def fun(t): if t<=-b: return -a elif fhttp://groups.google.com/group/sage-support URL: http://www.sagemath.org

[sage-support] Re: Deprecated syntax warnings for piecewise functions

2011-03-26 Thread achrzesz
sage: f0(x)=x^2 sage: f = piecewise([[(0,1), f0]]) sage: f(0.5) 0.250 -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.goo

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
sage: %time maxima('makelist(elliptic_ec(0.1*k),k,0,10)') CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.01 s [%pi/2,1.530757636897764,1.489035058095852,1.445363064412665, 1.399392138897432,1.350643881047676,1.298428035046913, 1.241670567945823,1.178489924327839,1.104774732704073,1

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
Oops sage: %time pts=maxima('makelist(elliptic_ec(0.01*k),k,0,100)') CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.05 s -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
Conversion to sage list: sage: pts0=map(n,pts) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: htt

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
sage: %time pts=maxima('makelist(elliptic_ec(float(1/(1+0.01*k))),k, 1,100)') CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.05 s sage: pts0=[RR(x) for x in pts] On 28 Mar, 15:39, ObsessiveMathsFreak wrote: > > sage: %time pts=maxima('makelist(elliptic_ec(0.01*k),k,0,100)') > > s

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
sage: from scipy.special import ellipk sage: time pts=[ellipk(1.0/(1.0+0.01*k)) for k in srange(0,1,0.01)] CPU times: user 0.02 s, sys: 0.00 s, total: 0.02 s Wall time: 0.02 s -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sa

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
of course k in range(1,101) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.or

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
If you mean complete elliptic integrals of the second kind then: sage: from scipy.special import ellipe sage: time pts=[ellipe(1.0/(1.0+0.01*k)) for k in range(1,101)] CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s Wall time: 0.02 s -- To post to this group, send email to sage-support@goog

[sage-support] Re: Elliptic Integral Code Very Slow

2011-03-28 Thread achrzesz
If you need more precision,you can also use mpmath sage: from mpmath import * sage: time pts=[ellipe(1.0/(1.0+0.01*k)) for k in range(1,101)] CPU times: user 0.03 s, sys: 0.00 s, total: 0.03 s Wall time: 0.03 s -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe

[sage-support] Re: Problem with solve and complex numbers: incorrect answer

2011-03-29 Thread achrzesz
sage: maxima('solve([imagpart(x)=0,imagpart(sqrt(-x^2-1))=0], [x])').sage() [] -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google

[sage-support] Re: Fwd: trouble installing sage

2011-03-29 Thread achrzesz
In instalatiopn guide you can find: SAGE_ATLAS_LIB - if you have an installation of ATLAS on your system and you want Sage to use it instead of building and installing its own version of ATLAS, set this variable to be the parent directory of your ATLAS installation: it should have a subdirectory l

[sage-support] Re: need eigenvectors of complex matrix to arbitrary precision

2011-03-30 Thread achrzesz
sage: gp_console() ? \p 100 realprecision = 115 significant digits (100 digits displayed) ? a=matrix(3,3,k,m,random(1.0))+I*matrix(3,3,k,m,random(1.0)); ? m=a*conj(a)~; ? mateigen(m) On 30 Mar, 18:20, Jason Grout wrote: > On 3/30/11 10:44 AM, Ben123 wrote: > > > > > Hello. I've written a sa

[sage-support] Re: need eigenvectors of complex matrix to arbitrary precision

2011-03-30 Thread achrzesz
eigenvectors of ttdag in PARI/GP, pass results back to sage > > Thanks for the help, > > On Mar 30, 2:45 pm, achrzesz wrote: > > > sage: gp_console() > > ?  \p 100 > >    realprecision = 115 significant digits (100 digits displayed) > > ? a=matrix(3,3,k,m,random(1

[sage-support] Re: need eigenvectors of complex matrix to arbitrary precision

2011-03-31 Thread achrzesz
Since GP/PARI default precision is 38 (on my system) (and I dont know how to set \p 100 from sage) it would be probably better to replace precision_digits=30 by precision_digits=38 On 30 Mar, 23:03, achrzesz wrote: > # NO WARRANTY > precision_digits=30 > nop=5 # rank of matrix >

[sage-support] Re: need eigenvectors of complex matrix to arbitrary precision

2011-03-31 Thread achrzesz
().transpose() m=gp(ttdag) gp('default(realprecision,100)') ev=gp.mateigen(m).sage() print ev[:-1] On 31 Mar, 11:47, achrzesz wrote: > Since GP/PARI default precision is 38 (on my system) > (and I dont know how to set \p 100 from sage) > it would be probably better to replace > pr

[sage-support] Re: need eigenvectors of complex matrix to arbitrary precision

2011-03-31 Thread achrzesz
] On 31 Mar, 12:14, achrzesz wrote: > #NOT CHECKED > precision_digits=100 > nop=5 # rank of matrix > MS_nop_comp=MatrixSpace(ComplexField(precision_digits),nop,nop) > tmat=MS_nop_comp(0) # zero-ize the values > ttdag=MS_nop_comp(0) > for a in range(nop): >   for b in rang

[sage-support] Re: date call

2011-03-31 Thread achrzesz
sage: import time sage: time.asctime(time.localtime()) 'Thu Mar 31 15:36:30 2011' On 31 Mar, 15:15, kcrisman wrote: > This could be useful:sage: import datetime > sage: datetime.datetime.now() > datetime.datetime(2011, 3, 31, 9, 13, 0, 932345) > And there are lots of methods and string formatting

[sage-support] Re: Arithmetic Progession syntax

2011-04-01 Thread achrzesz
sage: import scipy as sc sage: map(floor,sc.arange(0.0,1.2,0.1)) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1] On 1 Kwi, 21:17, ObsessiveMathsFreak wrote: > Thanks for that, but I've run into another issue. I don't know whether > this is related to the sequence syntax or not > > sage: for n in [0.0,0.1,..

[sage-support] Re: plotting arg() of complex-valued function

2011-04-04 Thread achrzesz
sage: plot(lambda w:arg(1/(I*w) + 1/2 + (I*w)) ,(w,0,5), axes_labels=['$Frequency$', '$Phase$']) On 4 Kwi, 22:41, Renan Birck Pinheiro wrote: > Hello, > > I define a complex-valued function, and then want to plot its absolute > value and argument: > > w = var('w') > V(omega) = 1/(I*omega) + 1/2 +

[sage-support] Re: Plotting Python functions of two variables

2011-04-08 Thread achrzesz
Or: sage: plot(lambda x: h(x,3), (x, 0, 4),exclude=[2]) On 8 Kwi, 21:00, John H Palmieri wrote: > On Friday, April 8, 2011 11:03:14 AM UTC-7, ObsessiveMathsFreak wrote: > > > I have a python type function taking two variables is defined in such > > a say that accidental evaluation is a possibili

[sage-support] Re: Graphics Array and latex legends

2011-04-08 Thread achrzesz
This works for me: p1=plot(x^2, (x, -pi, pi),label="f") G=graphics_array(((p1,p1),(p1,p1))) G.show(figsize=[8,8]) On 8 Kwi, 18:54, ObsessiveMathsFreak wrote: > I'm encountering a problem with graphics_array and latex use in plots. > The following command works fine > > p1=plot(x^2, (x, -pi, pi),

[sage-support] Re: Unable to Solve Simple Problem

2011-04-10 Thread achrzesz
sage: solve(x==sqrt(x+1),x,to_poly_solve='force') [x == 1/2*sqrt(5) + 1/2] On 10 Kwi, 09:01, ancienthart wrote: > Here's a one liner to filter the solutions. > > filter((lambda x: n(eq.subs(x).lhs()) == n(eq.subs(x).rhs())),solns) -- To post to this group, send email to sage-support@googlegroup

[sage-support] Re: Using scipy special functions

2011-04-10 Thread achrzesz
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

[sage-support] Re: Using scipy special functions

2011-04-10 Thread achrzesz
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

[sage-support] Re: Using scipy special functions

2011-04-10 Thread achrzesz
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]))

[sage-support] Re: Using scipy special functions

2011-04-10 Thread achrzesz
t * > > 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 Apr 10, 8:38 pm, achrzesz wrote: > > > Or simply legendre_P, legendre_Q > > Unfortunately, the

[sage-support] Re: Using scipy special functions

2011-04-11 Thread achrzesz
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: > > > Th

[sage-support] Re: Unable to Solve Simple Problem

2011-04-11 Thread achrzesz
I'm not sure but: sage: solve(x==sqrt(x+1),x,to_poly_solve='use_grobner=True') [x == 1/2*sqrt(5) + 1/2] On 11 Kwi, 12:24, ancienthart wrote: > Now THAT seriously needs to be made clearer in the documentation, including > some examples. > Also, how to use use_grobner because use_grobner=True don't

[sage-support] Re: Unable to Solve Simple Problem

2011-04-11 Thread achrzesz
to_poly_solve([(x-5)^2+y^2-16, (y-3)^2+x^2-9], [x,y], use_grobner=true); works in wxmaxima 0.8.7 but does not in maxima_console() On 11 Kwi, 13:06, achrzesz wrote: > I'm not sure but: > sage: solve(x==sqrt(x+1),x,to_poly_solve='use_grobner=True') > [x == 1/2*sqrt(5) + 1

[sage-support] Re: Unable to Solve Simple Problem

2011-04-11 Thread achrzesz
sage: solve([(x-5)^2+y^2-16, (y-3)^2+x^2-9], [x,y],to_poly_solve='use_grobner=True') [[x == -9/68*sqrt(55) + 135/68, y == -15/68*sqrt(5)*sqrt(11) + 123/68], [x == 9/68*sqrt(55) + 135/68, y == 15/68*sqrt(5)*sqrt(11) + 123/68]] On 11 Kwi, 13:29, achrzesz wrote: > to_poly_solve([(x-5)

[sage-support] Re: Unable to Solve Simple Problem

2011-04-11 Thread achrzesz
Oops! without "to_poly_solve='use_grobner=True'" also works On 11 Kwi, 13:37, achrzesz wrote: > sage: solve([(x-5)^2+y^2-16, (y-3)^2+x^2-9], > [x,y],to_poly_solve='use_grobner=True') > [[x == -9/68*sqrt(55) + 135/68, y == -15/68*sqrt(5)*sqrt(11) + > 123/

[sage-support] Re: Unable to Solve Simple Problem

2011-04-11 Thread achrzesz
)') %union([x=-(9*sqrt(55)-135)/68,y=-(3*5^(3/2)*sqrt(11)-123)/68], [x=(9*sqrt(55)+135)/68,y=(3*5^(3/2)*sqrt(11)+123)/68]) > Oops! > without "to_poly_solve='use_grobner=True'" > also works > > On 11 Kwi, 13:37, achrzesz wrote: > > > sage: solve(

[sage-support] Re: Using scipy special functions

2011-04-12 Thread achrzesz
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

[sage-support] Re: Using scipy special functions

2011-04-13 Thread achrzesz
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

[sage-support] Re: Using scipy special functions

2011-04-14 Thread achrzesz
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 > > >

[sage-support] Re: Integrals of trigonometric functions

2011-04-14 Thread achrzesz
In 64bit 4.6.2 fedora13 Dell Vostro 1720 sage: numerical_integral(lambda x: cos(2*x)*cos(x), 0, pi) (4.4478052108155282e-17, 1.3516940761795953e-14) sage: plot(cos(2*x)*cos(x), (x, 0, pi)) Maxima and Wolfram alpha: 0 sage: integral(cos(2*x)*cos(x), x, 0, pi) 4/3 On 15 Kwi, 05:27, Dan Drake wr

[sage-support] Re: Integrals of trigonometric functions

2011-04-14 Thread achrzesz
To be more precise: Maxima 5.23.2 gives 0 Sage 4.6.2 has 5.22.1 (and gives 4/3) On 15 Kwi, 06:00, achrzesz wrote: > In 64bit 4.6.2 fedora13 Dell Vostro 1720 > sage: numerical_integral(lambda x: cos(2*x)*cos(x),  0, pi) > (4.4478052108155282e-17, 1.3516940761795953e-14) > sage: plot(

[sage-support] Re: assumptions so that x^n -> 0?

2011-04-15 Thread achrzesz
Without additional assumption that x is constant the limit is not zero (take for example x=(1/2)^(1/(n+1)) (W... alpha: Assuming[x=const,x<1,x>0];Limit[x^(n+1)/(1-x),n->+Infinity] 0 OK, Assuming[x<1,x>0];Limit[x^(n+1)/(1-x),n->+Infinity] unevaluated OK) On 15 Kwi, 06:00, Dan Drake wrote: > Why d

[sage-support] Re: assumptions so that x^n -> 0?

2011-04-15 Thread achrzesz
One can discuss if in limits of f(x,n) as n-->oo x may depend on n or not but in the following version: sage: assume(x>-0.99,x<0.99) sage: n=var('n') sage: sage: limit(x^(n+1)/(1-x), n=infinity) -limit(x^(n + 1), n, +Infinity)/(x - 1) sage: assume(x>0) sage: sage: limit(x^(n+1)/(1-x), n=infinit

[sage-support] Re: assumptions so that x^n -> 0?

2011-04-16 Thread achrzesz
In W... alpha Assuming[x>-0.99,x<0.99];Limit[x^(n+1)/(1-x),n->+Infinity] remains unevaluated, so Maxima, Sage are nol alone On 16 Kwi, 08:18, achrzesz wrote: > One can discuss if in limits of f(x,n) as n-->oo > x may depend on n or not but in the following version: > >

[sage-support] Re: extracing terms from expressions

2011-04-16 Thread achrzesz
sage: R.=PolynomialRing(QQ,'x,y,z') sage: w=3/5*x*y+5*y+3*z sage: w.monomials() [x*y, y, z] sage: w1=3*x^2 sage: w1.monomials() [x^2] On 16 Kwi, 07:00, tvn wrote: > given an expression f of the form  c1*t1 + c2*t2 + .. +cn*tn,  I want to > extract from f the list of 'terms' [t1..tn]  .. is there

[sage-support] Re: assumptions so that x^n -> 0?

2011-04-16 Thread achrzesz
I must correct myself W... alpha: Assuming[x>-0.99,Assuming[x<0.99,Limit[x^(n+1)/(1-x),n->+Infinity]] gives correct answer 0 On 16 Kwi, 09:27, achrzesz wrote: > In W... alpha > Assuming[x>-0.99,x<0.99];Limit[x^(n+1)/(1-x),n->+Infinity] > remains unevaluated, so Maxima

[sage-support] Re: assumptions so that x^n -> 0?

2011-04-16 Thread achrzesz
In the last post one can replace 0.99 by 1 but I wanted to exclude the following situation: sage: n=var('n') sage: x=var('x') sage: x=(1/2)^(1/(n+1)) sage: limit(x^(n+1)/(1-x),n=+oo) +Infinity # OK On 16 Kwi, 15:36, achrzesz wrote: > I must correct myself > W...

[sage-support] Re: Plotting 3d graphs side by side

2011-04-16 Thread achrzesz
http://ask.sagemath.org/question/335/multiple-3d-plots-in-one-panel-graphics_array-and On 17 Kwi, 02:46, ObsessiveMathsFreak wrote: > Currently in sage 3D I can graph 3D plots in the same output, but not > side by side. > > p1=plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2)) > p2=plot3d(lambda x, y

[sage-support] Re: Numerical integration fails when taking real/imaginary part

2011-04-17 Thread achrzesz
sage: numerical_integral(lambda t:imaginary(gamma(1-I*t)),-15,15) (0.0, 5.3925521851144085e-15) On 18 Kwi, 00:02, Ian Petrow wrote: > Also, imaginary(gamma(1.+I*5)), say, works fine as long as it's not > inside a numerical integral > > Ian > > On Apr 17, 2:57 pm, Ian Petrow wrote: > > > Hello Ev

[sage-support] Re: Sage Scripts

2011-04-18 Thread achrzesz
Hello nkulmati If you want to get rid of virtualization maybe you should try Linux version without instalation burning Live-CD first The present version fits into memory and after (rather long) start process the CD can be removed It works quite satisfactory (if you have >=2GB RAM) The native Lin

[sage-support] Re: extracing terms from expressions

2011-04-29 Thread achrzesz
Artifical workaround: sage: R.=QQ[] sage: w=3*x^2+4*x sage: w.monomials() [x^2, x] On 29 Kwi, 00:28, tvn wrote: > Hi, the monimals function you suggested doesn't work for the below case > where I want to extract the terms  [x^2,x] from the given expression   > 3*x^2+4*x   . > > sage: type(x) >

[sage-support] Re: Plotting Functions of 3 variables

2011-05-05 Thread achrzesz
Maybe a series of implicit_plot3d with w=w0,w1,... will be helpful? On 5 Maj, 19:12, kcrisman wrote: > On May 5, 12:25 pm, ObsessiveMathsFreak > > wrote: > > I currently have a function of three variables w=f(x,y,z), which I > > would like to plot in 3D if possible (e.g. via coloured plots) > >

[sage-support] Re: integrate() problem

2011-07-12 Thread achrzesz
It seems that Maxima has problem here but mpmath has not: sage: from mpmath import * sage: mp.pretty=True sage: quad(lambda x:(x^2)*exp(x)/(1+exp(x))^2,[-inf,+inf]) 3.28986813369645 sage: n(pi^2/3) 3.28986813369645 A Ch -- To post to this group, send email to sage-support@googlegroups.com To uns

[sage-support] Re: list_plot does not plot numpy arrays any more

2011-07-12 Thread achrzesz
``list_plot`` takes either a single list of data, a list of tuples, or a dictionary and plots the corresponding points. sage: list_plot(data.tolist()) A Ch -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+u

[sage-support] Re: implicit_plot3d and solve

2011-07-12 Thread achrzesz
Example; intersection of an elipsoid and sphere: var('x,y,z') solve([x^2 +y^2+z^2 ==1,x^2+y^2+2*z^2 ==1],[x,y,z]) #[[x == r1, y == -sqrt(-r1^2 + 1), z == 0], [x == r2, y == sqrt(-r2^2 + 1), z == 0]] var('r1') p1=parametric_plot3d([r1,-sqrt(-r1^2 + 1),0], (-1,1),thickness=10,color='red') p2=paramet

[sage-support] Re: how to choose return values from solve

2011-07-15 Thread achrzesz
sage: assume(t,'real') sage: solve(diff(myHH,t),t) [t == 1/10*log(31)] -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/gro

[sage-support] Re: how to choose return values from solve

2011-07-15 Thread achrzesz
t=var('t') taum, tauh, m = var('taum, tauh, m') f(t) = (1-e^(-t/taum))^m*(e^(-t/tauh)) d=diff(f(t),t) d1=(d==0).full_simplify() print d1.solve(t) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegro

[sage-support] Re: solve() gives incorrect answers for nonlinear system?

2011-07-21 Thread achrzesz
Try something like this: from mpmath import * mp.dps = 30; mp.pretty = True f=[lambda s00, s01, s10, s11, k, p:0.55*k*s00 + 0.6*k*s01 + 0.6*k*s10 + 0.6*p*s01 + 0.6*p*s10 +0.55*p*s11 + 33*s00 + 33*s01 + 33*s10 + 33*s11 - 33.0, lambda s00, s01, s10, s11, k, p:0.55*k*s00 + 0.6*k*s01 + 0.6*k*s10 + 3

[sage-support] Re: Matrix Inverse

2011-07-27 Thread achrzesz
Or: sage: import numpy as np sage: from numpy import linalg as LA sage: a=np.random.rand(512,512) sage: ainv=LA.inv(a) sage: np.allclose(np.dot(ainv,a),np.eye(512)) True Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send

[sage-support] Re: Matrix Inverse

2011-07-27 Thread achrzesz
On i5-661: sage: timeit('ainv=LA.inv(a)') 5 loops, best of 3: 54.3 ms per loop -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google

[sage-support] Re: Matrix Inverse

2011-07-27 Thread achrzesz
sage: MS=MatrixSpace(RDF,512,512) sage: A=MS.random_element() sage: timeit('B=A.inverse()') 5 loops, best of 3: 41 ms per loop -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more op

[sage-support] Re: An integral solved by Mathematica, but not by Sage

2011-08-21 Thread achrzesz
sage: (integrate( exp(-x^2/2)/sqrt(2*pi) * sign(x-1), x, -oo, 1 ) +integrate( exp(-x^2/2)/sqrt(2*pi) * sign(x-1), x, 1, oo )).simplify_full() -erf(1/2*sqrt(2)) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubs

[sage-support] Re: exp(I*pi*n).simplify_exp() doesn't work well

2011-09-07 Thread achrzesz
Also: sage: n=var('n') sage: assume(n,'integer') sage: maxima('rectform(exp(%i*n*%pi))').sage().simplify_full() (-1)^n Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.c

[sage-support] Re: complex parts

2011-09-15 Thread achrzesz
> For trivial cases, yeah, but consider > >         parametric_plot((f(t-0.5j).real, f(t-0.5j).imag), (t,tmin,tmax)) > >         parametric_plot(ReIm(f(t-0.5j)), (t,tmin,tmax)) > > -- For example: sage: f(z)=[z.real(),z.imag()] sage: t=var('t') sage: parametric_plot(f(exp(I*(t-5*I))),(t,0,2*pi))

[sage-support] Re: for loop in 3d image

2011-09-15 Thread achrzesz
A colon is missing after range(20). The following version works for me: (but the indentation in this post may be broken) x,y,z,t = var('x,y,z,t') P = implicit_plot3d(x^2 +y^2 -z^2 ==1, (x,-3.2,3.2),(y,-3.2,3.2), (z,-3,3),opacity=.2,color='blue') for k in range(20): P += parametric_plot3d([cos(

[sage-support] Re: plot3d with adaptive=True fails

2011-09-15 Thread achrzesz
Also: sage: T = Cylindrical('height', ['radius', 'azimuth']) sage: r, theta, z = var('r theta z') sage: plot3d(r*sin(1/r), (r, 0.0, 0.2), (theta, 0, 2*pi), transformation=T,adaptive=True) Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe f

[sage-support] Re: Diagonalizing (symmetric) matrices with entries in a rational function field

2011-09-28 Thread achrzesz
On Sep 28, 2:48 pm, flyingsquirrel wrote: > I have a symmetric matrix that I want to diagonalize, such as > > x   y   z > y   0   xy > z   xy xyz > > x, y, z being variables, and the base field is CC (complex numbers). I > typed in the following: > > R.=CC[] > m=matrix(R,[[x,y,z],[y,0,x*y],[z,x*

[sage-support] Re: why doesn't [lambda x: bessel_J(n, x) for n in [0,1]] work?

2011-10-04 Thread achrzesz
> It seems unreasonably annoying to plot a bunch of Bessel functions > together. How can I work around this? > > Dan sage: pl=sum([plot(lambda x:bessel_J(x,n),(x,0,1)) for n in [1,2]]) sage: pl.show() Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To u

[sage-support] Re: Integrate 0 doesn't give zero.

2011-10-07 Thread achrzesz
The *indefinite* integral of zero is an arbitrary constant (not only zero) Compare more 'concrete' version sage: y = function('y',x) sage: a = 1 + diff(y,x) == 0 sage: var('t') t sage: assume(t>0) sage: integrate(a,(x,0,t)) t - y(0) + y(t) == 0 Andrzej Chrzeszczyk -- To post to this group, send

[sage-support] Re: weird binomial error

2011-10-07 Thread achrzesz
This also works: sage: k=var('k') sage: sum('binomial(8,k)',k,0,8) 256 Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http:/

[sage-support] Re: integral of exp(-x^2)*cos(x) from -pi to pi is complex?

2011-10-08 Thread achrzesz
The exact integral 1/2*(erf(pi - 1/2*I) + erf(pi + 1/2*I))*sqrt(pi)*e^(-1/4) contains *real* expression (erf(pi - 1/2*I) + erf(pi + 1/2*I)) but maxima/sage can't check that it is real In WolframAlpha one can check that Im[Erf[Pi-1/2*I]+Erf[Pi+1/2*I]] iz zero Andrzej Chrzeszczyk -- To post

[sage-support] Re: integral of exp(-x^2)*cos(x) from -pi to pi is complex?

2011-10-08 Thread achrzesz
> > We need to work on the numerical approximation stuff for the error > function! > > Dan More generally in my opinion n() in complex domain needs improvement For example (as I have mentioned) sage: ((-1)^(1/3)).n() 0.500 + 0.866025403784439*I leads to wrong solution sage: s=solve

[sage-support] Re: Bessel Contour Plot problem

2011-10-21 Thread achrzesz
This version works for me: r,z = var('r,z') gro = 1.0 kro = 3.0 def f(r,z): term1 = (1+(bessel_J(0, gro)/bessel_J(2,gro)))*(r/ kro)*(bessel_J(1, r)/bessel_J(1,gro))*cos(z) term2 = -(bessel_J(0,r)/bessel_J(2, gro))*(r**2/kro**2) return term1 + term2 p = contour_plot(f , (r, 0, 2.5), (z,

[sage-support] Re: How to evaluate integral(sin(x^2),x,0,2) as a real number?

2011-10-21 Thread achrzesz
On Oct 22, 4:57 am, Gary Church wrote: > Hello all, > > How can I evaluate > > integral(sin(x^2),x,0,2) > > to get a real value instead of the nasty expression involving erf() and I > that it spits out at me? > > Thanks much, > Gary One can check that the "nasty expression" is real: sage: w=in

[sage-support] Re: How to evaluate integral(sin(x^2),x,0,2) as a real number?

2011-10-22 Thread achrzesz
> Is that "integrate_numerical" or "numerical_integral"? sage: numerical_integral(sin(x^2),0,2) (0.80477648934375612, 1.0932458096886601e-14) Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsu

[sage-support] Re: integral of exp(-x^2)*cos(x) from -pi to pi is complex?

2011-10-23 Thread achrzesz
On Oct 8, 10:05 am, achrzesz wrote: > The exact integral > > 1/2*(erf(pi - 1/2*I) + erf(pi + 1/2*I))*sqrt(pi)*e^(-1/4) > > contains *real* expression > > (erf(pi - 1/2*I) + erf(pi + 1/2*I)) > > but maxima/sage can't check that it is real > > In WolframAlph

[sage-support] Re: Graphics Array and one function with different constants.

2011-10-23 Thread achrzesz
On Oct 23, 11:33 pm, Eric Kangas wrote: > Hi, > > I have one function that I need to plot in an array with different > values for two constants. I would like to only have to repeat the > function once, and go off of a string of different variables to > produce this array. Is that even possible i

[sage-support] Re: finding the closed form for a linear second order recurrence sequence

2011-10-24 Thread achrzesz
sage: maxima('batch(solve_rec)') "/home/andy/Pobrane/sage-4.7.1/local/share/maxima/5.23.2/share/contrib/ solve_rec/solve_rec.mac" sage: maxima('deq: u[n+2]=2*u[n + 1] + 8*u[n];') u[n+2]=2*u[n+1]+8*u[n] sage: maxima('sol:solve_rec(deq,u[n],u[0]=2,u[1]=7);') u[n]=11*4^n/6-(-2)^(n-1)/3 Andrzej Chrze

  1   2   >