[sage-support] Re: Strange sum() result and can't be evaluated numerically

2012-09-15 Thread achrzesz
sage: s=maxima('1/2*sqrt(%pi)*sqrt(2)*sqrt(x)*bessel_j(1/2, x),besselexpand:true') sage: s.sage().full_simplify() sin(x) On Saturday, September 15, 2012 6:53:34 AM UTC+2, Renan Birck Pinheiro wrote: The command sum( ((-1)^k*(x^(2*k+1))/factorial(2*k+1)),k,0,oo)

[sage-support] Re: sorting lists of Expressions

2012-09-15 Thread achrzesz
For example: sage: a=[[QQ((x2).rhs()),+oo],[-oo,QQ((x1).rhs())]]; a.sort(); print a [[-Infinity, 1], [2, +Infinity]] On Saturday, September 15, 2012 7:32:22 PM UTC+2, aurelie...@yahoo.fr wrote: I stumbled upon the following problem: the following code does not work as it should:

[sage-support] Re: empty result on system of equation

2012-09-06 Thread achrzesz
The equations you provided are vector-valued and Sage expects scalar ones Is that what you are expecting: a,b,c,d,e,f,t = var('a,b,c,d,e,f,t') v(t)=(t,t) u(t)=(2+t,1-t) B(t)=(a*t^2+b*t+c,d*t^2+e*t+f) eq10=v(t).substitute(t==1)[0]==B(t).substitute(t==0)[0] # v(1)==B(0)

[sage-support] Re: basic question on constant of integration when using desolve

2012-07-26 Thread achrzesz
Sometimes a workaround is possible: sage: x = var('x') sage: y = function('y', x) sage: C = var('C') sage: f = desolve(diff(y,x) + y, y, ics=[0,C]); f C*e^(-x) sage: c = var('c') sage: f = desolve(diff(y,x) +c*y, y,ivar=x, ics=[0,C]); f C*e^(-c*x) On Thursday, July 26, 2012 12:37:56 PM UTC+2,

[sage-support] Re: Ploting an arc and shading the area within the arc using Sage

2012-07-16 Thread achrzesz
l1=[(cos(phi),sin(phi)) for phi in srange(n(pi)/4,3*n(pi)/4,0.01)] l2=[(2*cos(phi),2*sin(phi)) for phi in srange(n(pi)/4,3*n(pi)/4,0.01)] l2.reverse() p=polygon(l1+l2) c1=circle((0,0), 1,rgbcolor=(0,0,0)) c2=circle((0,0), 2,rgbcolor=(0,0,0))

[sage-support] Re: Ploting an arc and shading the area within the arc using Sage

2012-07-16 Thread achrzesz
l1=[(3*cos(phi),3*sin(phi)) for phi in srange(n(pi)/2,3*n(pi)/2,0.01)] l2=[(6*cos(phi),6*sin(phi)) for phi in srange(n(pi)/2,3*n(pi)/2,0.01)] l2.reverse() figure4=polygon(l1+l2) figure4.show(xmin=-6,xmax=6) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from

[sage-support] Re: Ploting an arc and shading the area within the arc using Sage

2012-07-16 Thread achrzesz
#You probably need the right-hand sem-iring: l1=[(3*cos(phi),3*sin(phi)) for phi in srange(-n(pi)/2,n(pi)/2,0.01)] l2=[(6*cos(phi),6*sin(phi)) for phi in srange(-n(pi)/2,n(pi)/2,0.01)] l2.reverse() figure4=polygon(l1+l2) figure4.show(xmin=-6,xmax=6) -- To post to this group, send email to

[sage-support] Re: Ploting an arc and shading the area within the arc using Sage

2012-07-15 Thread achrzesz
On Monday, July 16, 2012 12:49:32 AM UTC+2, The Doctor (Michael) wrote: Yes,that is correct Jason.Thanks. i have another question along the same vein. I need to plot a polar region between 2 circles of radius 1 and 2, from pi/4 = theta M= 3*pi/4. Here is what I tried, but I got a bunch

[sage-support] Re: Multiplicity of roots nummerical

2012-06-29 Thread achrzesz
Notice that roots gives you the multiplicity sage: f=(x-1)^2 sage: f.roots(ring=RealField()) [(1.00, 2)] sage: f=x^3-x-1 sage: f.roots(ring=RealField()) [(1.32471795724475, 1)] sage: f.roots(ring=RDF) [(1.32471795724, 1)] sage: f.roots(ring=CDF) [(-0.662358978622 - 0.562279512062*I,

[sage-support] Re: command for solving recursions

2012-06-21 Thread achrzesz
sage: import sympy sage: sympy.rsolve? On Wednesday, June 20, 2012 6:43:21 PM UTC+2, Daniel Krenn wrote: Is there something to solve recursions (e.g. linear recursions, but also others) in Sage? Or, formulated in another way: Is there something in Sage like RSolve in Mathematica? -- To

[sage-support] Re: Error in integrate

2012-04-14 Thread achrzesz
On Saturday, April 14, 2012 6:04:44 PM UTC+2, Laurent Decreusefond wrote: Dear all, here is my problem sage: var('t') t sage: integrate(e^(-2*t)/sqrt(1-e^(-2*t)),t,0,infinity) -1 ... a negative value for the integral of a positive function. On the other hand sage:

[sage-support] Re: integrate

2012-02-01 Thread achrzesz
On 1 Lut, 10:49, Ajay Rawat ajay.rawa...@gmail.com wrote: Hi, I want to integrate (int x*exp(-x^2)/(x-1) , -inf, inf) how to do this Thanking you -- Ajay Rawat Kalpakkam, IGCAR - Save Himalayas

[sage-support] Re: suggested improvement for simplify_trig

2012-01-28 Thread achrzesz
On Jan 25, 6:21 pm, William Stein wst...@gmail.com wrote: On Wed, Jan 25, 2012 at 7:25 AM, kcrisman kcris...@gmail.com wrote: Probably that should be implemented inside the trigonometric functions code itself, instead of in any of the simplify's. What do you think? +1 It's

[sage-support] Re: coefficients(x) throws TypeError

2012-01-26 Thread achrzesz
On Jan 25, 2:26 pm, Peter Luschny peter.lusc...@googlemail.com wrote: Hi, with Sage Notebook Version 4.7.2: Z0 =                   1118557440*x^5 + 180204024*x^4 + 15195180*x^3 + 523250*x^2 + 4095*x + 1 Z1 = 4115105280L*x^6 + 1118557440*x^5 + 180204024*x^4 + 15195180*x^3 + 523250*x^2 +

[sage-support] Re: Solving differential equations with unit_step?

2012-01-10 Thread achrzesz
On Jan 9, 6:39 pm, Renan Birck Pinheiro renan.ee.u...@gmail.com wrote: Hi, I'm trying to solve a differential equation with unit step, e.g. the equation y'(x) = U(x-5) - where U is the unit step, and the inicial condition y(0) is 0. The result is 0 for 0x5 and x-5 for x5 (it's a simple

[sage-support] Re: Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread achrzesz
On Dec 31, 11:21 am, Christophe BAL projet...@gmail.com wrote: Hello, the following command has a very bad output. plot(sqrt((x - 2)*(x - 1)), (-4, 5)) + plot(-sqrt((x - 2)*(x - 1)), (-4, 5)) How can I ameliorate this ? Best regards. Christophe Your function is comlex-valued on the

[sage-support] Re: Poisson distribution

2011-12-29 Thread achrzesz
On Dec 28, 8:13 pm, akm andrew.mussel...@gmail.com wrote: Hi all, can anyone recommend a way of generating random numbers via a Poisson distribution? I'm trying to wrangle scipy.stats.poisson to get something centered at 10, say, with a nice long tail out to the right, but I can't figure

[sage-support] Re: Asymptotics of binomial coefficients

2011-12-28 Thread achrzesz
On Dec 28, 6:26 am, shreevatsa shreevatsa.pub...@gmail.com wrote: Hi, I'm trying to use Sage to find the asymptotics of binomial coefficients. Specifically, I wanted to find out the rate at which binomial(n, n/2)/2^n goes down to 0 as n goes to infinity. See Wolfram

[sage-support] Re: Asymptotics of binomial coefficients

2011-12-28 Thread achrzesz
On Dec 28, 1:54 pm, achrzesz achrz...@wp.pl wrote: On Dec 28, 6:26 am, shreevatsa shreevatsa.pub...@gmail.com wrote: Hi, I'm trying to use Sage to find the asymptotics of binomial coefficients. Specifically, I wanted to find out the rate at which binomial(n, n/2)/2^n goes down to 0

[sage-support] Re: Asymptotics of binomial coefficients

2011-12-28 Thread achrzesz
On Dec 28, 6:14 pm, achrzesz achrz...@wp.pl wrote: On Dec 28, 1:54 pm, achrzesz achrz...@wp.pl wrote: On Dec 28, 6:26 am, shreevatsa shreevatsa.pub...@gmail.com wrote: Hi, I'm trying to use Sage to find the asymptotics of binomial coefficients. Specifically, I wanted to find out

[sage-support] Re: Trigonometric linearization

2011-12-13 Thread achrzesz
sage: (cos(x)^3).reduce_trig() 1/4*cos(3*x) + 3/4*cos(x) On Dec 13, 7:45 pm, Christophe BAL projet...@gmail.com wrote: Hello, what is the easiest way to linearize cos(x)^3 ? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: Boolean function

2011-12-12 Thread achrzesz
On Dec 12, 7:03 am, Santanu Sarkar sarkar.santanu@gmail.com wrote: Sorry I meant to write But it does not work apologies for the typo On 12 December 2011 07:49, Santanu Sarkar sarkar.santanu@gmail.com wrote: I have a set of Boolean functions like A[0]=x1*x2+x3*x4

[sage-support] Re: Low order digits from thin air

2011-12-12 Thread achrzesz
On Dec 12, 2:39 pm, v...@ukr.net wrote: On Mon, 12 Dec 2011 07:16:17 -0600Jason Grout jason-s...@creativetrax.com wrote: sage: round(-0.02800200,12) -0.028 See http://www.sagemath.org/doc/reference/sage/misc/functional.html?#sage...   Thanks a lot! :)   It looks like I

[sage-support] Re: problem evaluating integral

2011-12-11 Thread achrzesz
sage: N(pi^2/6, digits=17) 1.6449340668482264 sage: numerical_integral(x/(exp(x)-1),0,oo) (1.6449340668482264, 5.9356452836178026e-10) On Dec 11, 6:45 pm, andres.ordonez andres.felipe.ordo...@gmail.com wrote: That'll do. Thanks On Dec 10, 8:19 pm, Renan Birck Pinheiro renan.ee.u...@gmail.com

[sage-support] Re: problem evaluating integral

2011-12-11 Thread achrzesz
On Dec 11, 7:30 pm, achrzesz achrz...@wp.pl wrote: sage: N(pi^2/6, digits=17) 1.6449340668482264 sage: numerical_integral(x/(exp(x)-1),0,oo) (1.6449340668482264, 5.9356452836178026e-10) On Dec 11, 6:45 pm, andres.ordonez andres.felipe.ordo...@gmail.com wrote: That'll do. Thanks

[sage-support] Re: problem evaluating integral

2011-12-11 Thread achrzesz
On Dec 11, 10:59 pm, achrzesz achrz...@wp.pl wrote: On Dec 11, 7:30 pm, achrzesz achrz...@wp.pl wrote: sage: N(pi^2/6, digits=17) 1.6449340668482264 sage: numerical_integral(x/(exp(x)-1),0,oo) (1.6449340668482264, 5.9356452836178026e-10) On Dec 11, 6:45 pm, andres.ordonez

[sage-support] Re: Question about minimal polynomial to build GF

2011-12-11 Thread achrzesz
On Dec 12, 12:10 am, juaninf juan...@gmail.com wrote: Hi everybody I want choose different minimal polynomial to build a Galois Field 2^m, how? For example: m = 8 sageF.a=GF(2^8) sage:print a.minpoly() I get ... x^8 + x^4 + x^3 + x^2 + 1 but I want now other polynomial for example

[sage-support] Re: Question about minimal polynomial to build GF

2011-12-11 Thread achrzesz
On Dec 12, 12:31 am, achrzesz achrz...@wp.pl wrote: On Dec 12, 12:10 am, juaninf juan...@gmail.com wrote: Hi everybody I want choose different minimal polynomial to build a Galois Field 2^m, how? For example: m = 8 sageF.a=GF(2^8) sage:print a.minpoly() I get ... x^8 + x^4

[sage-support] Re: Question about minimal polynomial to build GF

2011-12-11 Thread achrzesz
On Dec 12, 12:41 am, Juan Grados juan...@gmail.com wrote: but when I put this polynomial  x^8+x^7+x^4+x^3+x+1 I get ValueError: finite field modulus must be irreducible but it is not 2011/12/11 achrzesz achrz...@wp.pl On Dec 12, 12:10 am, juaninf juan...@gmail.com wrote: Hi

[sage-support] Re: Question about minimal polynomial to build GF

2011-12-11 Thread achrzesz
On Dec 12, 12:47 am, achrzesz achrz...@wp.pl wrote: On Dec 12, 12:41 am, Juan Grados juan...@gmail.com wrote: but when I put this polynomial  x^8+x^7+x^4+x^3+x+1 I get ValueError: finite field modulus must be irreducible but it is not 2011/12/11 achrzesz achrz...@wp.pl On Dec 12

[sage-support] Re: Question about minimal polynomial to build GF

2011-12-11 Thread achrzesz
On Dec 12, 1:08 am, achrzesz achrz...@wp.pl wrote: On Dec 12, 12:47 am, achrzesz achrz...@wp.pl wrote: On Dec 12, 12:41 am, Juan Grados juan...@gmail.com wrote: but when I put this polynomial  x^8+x^7+x^4+x^3+x+1 I get ValueError: finite field modulus must be irreducible

[sage-support] Re: legend_label doesn't work with graphics_array

2011-12-10 Thread achrzesz
On Dec 10, 2:48 pm, v...@ukr.net wrote:   Hello!   Today I have noticed that if I cannot use the legend_label plot parameter while joining several plots in one grahpics_array object.   For example, the following code works fine:         plot1 = plot(sin, xmin=0, xmax=8*pi)         plot2 =

[sage-support] Re: equation with complex number

2011-12-09 Thread achrzesz
On Dec 9, 12:18 pm, David Joyner wdjoy...@gmail.com wrote: This is a question for sage-support, which I am ccing. On Fri, Dec 9, 2011 at 5:04 AM, Jean-Patrick Pommier jeanpatrick.pomm...@gmail.com wrote: Hi, Is it possible to solve equation with complex variable such 1/z=1+i? I try

[sage-support] Re: transforming numbers into lists.

2011-12-08 Thread achrzesz
On Dec 8, 3:48 pm, Eric Kangas eric.c.kan...@gmail.com wrote: thanks i tried it with N(pi, digits = 100) and sage didn't like that format. On Dec 8, 6:39 am, Jason Grout jason-s...@creativetrax.com wrote: On 12/8/11 7:16 AM, Eric Kangas wrote: Hi, I remembering reading one of the

[sage-support] Re: transforming numbers into lists.

2011-12-08 Thread achrzesz
On Dec 8, 3:58 pm, achrzesz achrz...@wp.pl wrote: On Dec 8, 3:48 pm, Eric Kangas eric.c.kan...@gmail.com wrote: thanks i tried it with N(pi, digits = 100) and sage didn't like that format. On Dec 8, 6:39 am, Jason Grout jason-s...@creativetrax.com wrote: On 12/8/11 7:16 AM, Eric

[sage-support] Re: transforming numbers into lists.

2011-12-08 Thread achrzesz
On Dec 8, 4:35 pm, achrzesz achrz...@wp.pl wrote: On Dec 8, 3:58 pm, achrzesz achrz...@wp.pl wrote: On Dec 8, 3:48 pm, Eric Kangas eric.c.kan...@gmail.com wrote: thanks i tried it with N(pi, digits = 100) and sage didn't like that format. On Dec 8, 6:39 am, Jason Grout jason-s

[sage-support] Re: assumptions

2011-12-08 Thread achrzesz
On Dec 8, 9:36 pm, robin hankin hankin.ro...@gmail.com wrote: hello I have been playing with assumptions().  I want to assume ab but solve() gives me a solution which is not consistent with this: sage: var('a b') (a, b) sage: assume(ab) sage: assumptions() [a b] sage:

[sage-support] Re: why is this contour integral wrong?

2011-12-06 Thread achrzesz
On Dec 6, 3:26 pm, kcrisman kcris...@gmail.com wrote: The problem is that the integral should not depend on the center of the circle containing the pole. It looks like maxima bug (?) I've reported this athttps://sourceforge.net/tracker/?group_id=4933atid=104933 Dan, if you want to

[sage-support] Re: why is this contour integral wrong?

2011-12-05 Thread achrzesz
On Dec 5, 5:31 am, Dan Drake dr...@kaist.edu wrote: I keep wondering whether Sage is making a mistake, or I'm not understanding complex analysis. I'm a little afraid to learn the answer. :) Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere except at -1/2-I/3, where it has

[sage-support] Re: why is this contour integral wrong?

2011-12-05 Thread achrzesz
On Dec 5, 10:04 am, achrzesz achrz...@wp.pl wrote: On Dec 5, 5:31 am, Dan Drake dr...@kaist.edu wrote: I keep wondering whether Sage is making a mistake, or I'm not understanding complex analysis. I'm a little afraid to learn the answer. :) Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3

[sage-support] Re: Define polynomial rings of given variables

2011-12-05 Thread achrzesz
On Dec 5, 3:18 pm, Subhadeep Banik monsieurlel...@gmail.com wrote: If I have a boolean  expression of a certain number of variables, how do I define a polynomial ring with them.. For example, let (x0,x1,x2,x3,x4,x5,x6,x7) be a set of variables, and I have  an expression S = x0 + x1*x3 + x7

[sage-support] Re: why is this contour integral wrong?

2011-12-05 Thread achrzesz
On Dec 5, 4:56 pm, kcrisman kcris...@gmail.com wrote: So it sounds like you should file a ticket, Dan.  Maybe we're just sending it to Maxima wrong. (%i9) f(z):=(z-%i)*(z-1)^2/(z-(-1/2-%i/3));                                                    2                                    (z - %i)

[sage-support] Re: why is this contour integral wrong?

2011-12-04 Thread achrzesz
On Dec 5, 5:31 am, Dan Drake dr...@kaist.edu wrote: I keep wondering whether Sage is making a mistake, or I'm not understanding complex analysis. I'm a little afraid to learn the answer. :) Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere except at -1/2-I/3, where it has

[sage-support] Re: Power series expansion

2011-12-02 Thread achrzesz
On Dec 2, 2:24 pm, Julie juliewilliams...@googlemail.com wrote: Hi all, I am attempting to obtain coefficients of a generating function to obtain probabilites, but in order to obtain the coefficients, I first need to expand a power series, which is necessary for my paricular function. Is

[sage-support] Re: assumption in symbolic solve

2011-11-30 Thread achrzesz
On Nov 30, 8:17 pm, Th btho...@nexus.hu wrote: Dear All, I am new to sage (converting from mathcad), so please forgive my basic question. I am trying to solve system of equations in a symbolic way, as a simple example: var('a,b,c,d,d1,d2,d3,x,x1,x2,x3,y,y1,y2,y3') symsys=[  

[sage-support] Re: Problem with integrals and assumptions

2011-11-27 Thread achrzesz
On Nov 27, 2:16 am, kcrisman kcris...@gmail.com wrote: Here's this in Sage.  See the end of this post for a solution you might like better than the ramblings in between :) -- | Sage Version 4.7.2, Release Date: 2011-10-29  

[sage-support] Re: Coefficients of multivariate polynomials in series expansion

2011-11-24 Thread achrzesz
On Nov 24, 5:55 pm, Julie juliewilliams...@googlemail.com wrote: I have a generating function programmed with two variables, for which I wish to find the coefficients of each polynomial in the series expansion, i.e. coefficiecnt of xy, x^2y, x^2y^2,... For example, using a simple function

[sage-support] Re: Can Sage draw the Batman Equation directly with implicit_plot ?

2011-11-14 Thread achrzesz
Workaround: sage: f=[f1,f2,f3,f4,f5,f6] sage: sum([implicit_plot(g,(x,-8,8),(y,-5,5),plot_points=num) for g in f]) (The eq. prod(f)==0 is really complicated) Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: Bessel functions and Zernike polynomials

2011-11-13 Thread achrzesz
sage: pl=sum([plot(lambda x:bessel_J(x,n),(x,0,1),color=hue(n/ 5.0),legend_label=str(n)) for n in [1..4]]) sage: pl.show() sage: numerical_integral(lambda x:bessel_J(x,2),1,2) (0.48267531157352617, 5.3587724432705002e-15) Andrzej Chrzeszczyk -- To post to this group, send email to

[sage-support] Re: Bessel functions and Zernike polynomials

2011-11-13 Thread achrzesz
sage: maxima('integrate(bessel_j(1,x), x)') -bessel_j(0,x) 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

[sage-support] Re: Apparent bug with evaluating an indefinite integral

2011-11-12 Thread achrzesz
sage: import sympy sage: sympy.integrate(1/(sqrt(x)*((1+sqrt(x))^2)),(x,1,9)) 1/2 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

[sage-support] Re: Numerical solution of systems of nonlinear (in)equalities

2011-11-03 Thread achrzesz
Hello Urs Here is an example with 6 variables Unfortunatly I dont remember the source or Author import scipy from scipy import optimize as opt def f(x): s00=x[0];s01=x[1];s10=x[2];s11=x[3];k=x[4];p=x[5] eq1 = 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 +

[sage-support] Re: Numerical solution of systems of nonlinear (in)equalities

2011-11-02 Thread achrzesz
Hello Urs fsolve from scipy does solve systems (look at scipy reference) All functions I have mentioned solve nonlinear systems of *equations* Maxima has also function mnewton solving nonlinear systems Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com

[sage-support] Re: Numerical solution of systems of nonlinear (in)equalities

2011-11-01 Thread achrzesz
For larger problems: from scipy.optimize import newton_krylov newton_krylov? (examples in scipy reference) 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...@googlegroups.com For more options,

[sage-support] Re: Numerical solution of systems of nonlinear (in)equalities

2011-10-31 Thread achrzesz
1) solve? (some nonlinear systems are solved numerically) 2) from scipy.optimize import fsolve fsolve? 3) from mpmath import findroot findroot? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: Area of the intersection of two regions

2011-10-30 Thread achrzesz
In Sage you need more steps. Assuming that you need the exact and the approximate value: var('x y') s=solve([x^2+y^2-4==0,x+y-1==0],[x,y]) x0,x1=[sol[0].rhs() for sol in s] assume(abs(x)2) ii=integrate(integrate(1,(y,1-x,sqrt(4-x^2))),(x,x0,x1)) #print ii print ii.n() #3.31871699805750 (The

[sage-support] Re: Area of the intersection of two regions

2011-10-30 Thread achrzesz
I must correct myself The region you asked has the area sage: (pi*2^2-ii).n() 9.24765361630167 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...@googlegroups.com For more options, visit this

[sage-support] Re: A typical microeconomic problem with SAGE (Constrained optimization)

2011-10-29 Thread achrzesz
If you realy need the exact solution then you can tray something like that var('x,y,lam,x4,y2') assume(x40) assume(y20) L= x+2*y -lam*(16-2*x^(1/4)*y^(1/2)) eq1=numerator(factor(L.diff(x))) eq1=eq1(y=y2^2,x=x4^4).full_simplify() eq2=numerator(factor(L.diff(y)))

[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

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

2011-10-24 Thread achrzesz
Also: sage: from sympy import * sage: n = Symbol('n', integer=True) sage: u = Function('u') sage: f=u(n+2)-2*u(n+1)-8*u(n) sage: rsolve(f,u(n),{u(0):2,u(1):7}) (-2)**n/6 + 11*4**n/6 Andrzej Chrzeszczyk -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from

[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 achrz...@wp.pl 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 WolframAlpha one can check that Im[Erf[Pi-1/2

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

2011-10-23 Thread achrzesz
On Oct 23, 11:33 pm, Eric Kangas eric.c.kan...@gmail.com 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

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

2011-10-22 Thread achrzesz
On Oct 22, 4:57 am, Gary Church gary.chur...@comcast.net 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

[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] 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),

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

2011-10-09 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:

[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

[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(t0) 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

[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

[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 coskun.e...@yahoo.com 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.x,y,z=CC[]

[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 +=

[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

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

2011-09-08 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] 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] 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

[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

[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 +

[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

[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] 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

[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] 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')

[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 kcris...@gmail.com wrote: On May 5, 12:25 pm, ObsessiveMathsFreak obsessivemathsfr...@gmail.com wrote: I currently have a function of three variables w=f(x,y,z), which I would like to plot in 3D

[sage-support] Re: extracing terms from expressions

2011-04-29 Thread achrzesz
Artifical workaround: sage: R.x,y=QQ[] sage: w=3*x^2+4*x sage: w.monomials() [x^2, x] On 29 Kwi, 00:28, tvn nguyenthanh...@gmail.com 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-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

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

2011-04-17 Thread achrzesz
http://ask.sagemath.org/question/335/multiple-3d-plots-in-one-panel-graphics_array-and On 17 Kwi, 02:46, ObsessiveMathsFreak obsessivemathsfr...@gmail.com 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),

[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 ianpet...@gmail.com 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

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

2011-04-16 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,x0.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(x0) sage: sage: limit(x^(n+1)/(1-x), n=infinity)

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

2011-04-16 Thread achrzesz
In W... alpha Assuming[x-0.99,x0.99];Limit[x^(n+1)/(1-x),n-+Infinity] remains unevaluated, so Maxima, Sage are nol alone On 16 Kwi, 08:18, achrzesz achrz...@wp.pl 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: assume(x-0.99

[sage-support] Re: extracing terms from expressions

2011-04-16 Thread achrzesz
sage: R.x,y,z=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 nguyenthanh...@gmail.com wrote: given an expression f of the form  c1*t1 + c2*t2 + .. +cn*tn,  I want to extract from f the list of

[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[x0.99,Limit[x^(n+1)/(1-x),n-+Infinity]] gives correct answer 0 On 16 Kwi, 09:27, achrzesz achrz...@wp.pl wrote: In W... alpha Assuming[x-0.99,x0.99];Limit[x^(n+1)/(1-x),n-+Infinity] remains unevaluated, so Maxima, Sage are nol alone

[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 achrz...@wp.pl wrote: I must correct myself W... alpha: Assuming[x

[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,x1,x0];Limit[x^(n+1)/(1-x),n-+Infinity] 0 OK, Assuming[x1,x0];Limit[x^(n+1)/(1-x),n-+Infinity] unevaluated OK) On 15 Kwi, 06:00, Dan Drake dr...@kaist.edu

[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) type 'sage.rings.complex_number.ComplexNumber' On 13 Kwi, 23:45, Fredrik Johansson fredrik.johans...@gmail.com wrote: On Apr 13, 7:48 pm,

[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

[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 achrz...@wp.pl 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(cos

[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

[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:

  1   2   >