[sage-support] real, imag and plot

2009-09-08 Thread Francois Maltey
Hello, I discover sage and can't plot this second parametric curve : var("a") parametric_plot ((cos (a), sin (a)),(a,-5,5)) # is right parametric_plot ((real (e^(i*a)), imag(e^(i*a))),(a,-5,5)) # doesn't plot I also test it with the N function... I get the same error. --~--~-~--~--

[sage-support] Re: real, imag and plot

2009-09-08 Thread Francois Maltey
I continue to try to plot in the complex plane the 4 solutions of the equation : z^4+2*a*z^2+1 = 0 when a is a real. I want to get a circle and 2 lines... Guru ckrisman explains that today this plot seems impossible and gives me a tip with lambda : calls in plot. I can make more parametr

[sage-support] expand, combine and rewrite with sage.

2009-09-14 Thread Francois Maltey
Hello, I don't find usual trigonometric transform in sage : expand (sin (2*x)) == 2*sin(x)*cos(x) combine (cos(a)^2) == 1/2 + cos(2*a)/2 rewrite (sin(a), exp) == (exp(i*a)-exp(-i*a)) / (2*i) I can use maxima("expand (sin(a+b))") or fricas ("...") calls but not the inner sage system. And use st

[sage-support] About exp (a)^b

2009-09-16 Thread Francois Maltey
Hi, I play with sage, exp, sin, cos, sinh, and co... var("a,b,c") exp(a)^2 # returns exp(2a) is right exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get -1=1 exp(a)^b # returns exp(a*b) is wrong But silly examples about power and asin (sin (x)) seems right. I find that sage (but i

[sage-support] Re: About exp (a)^b

2009-09-17 Thread Francois Maltey
kcrisman wrote : > On Sep 16, 4:04 pm, Francois Maltey wrote: > >> I play with sage, exp, sin, cos, sinh, and co... >> >> var("a,b,c") >> exp(a)^2 # returns exp(2a) is right >> exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we ge

[sage-support] Anonymous functions in sage : I can't iterate and insert a test.

2009-09-19 Thread Francois Maltey
Hello, Is it possible to compose/iterate functions in sage by a functional way without any loop for or while. When I used mupad I could get the u(100) term of this sequence by : (sin@@100) (1) # u(0)=1 and u(n+1)=sin (u(n)) What does sage propose ? (without any loop) An other question : How

[sage-support] Re: expand, combine and rewrite with sage.

2009-09-21 Thread Francois Maltey
About expand and combine Let me enumerate some transforms used in mathematic calculus. I describe what I understand and insert questions with ???. I only details theses methods because they are very similar. 4 are called "expand" and 4 are called "combine". Both are used in mathematics. e^(2x

[sage-support] Help for a single test in a function.

2009-09-23 Thread Francois Maltey
Hello Everybody ! With sage in emacs I test this single function, but I get an error : > def ff (n) : > if n==0 : > return(1) > else : > return(n*ff(n-1)) I type theses lines in a buffer, and I copy by Ctrl-K / Ctrl-Y in sage-buffer Then I get this error : > : : :

[sage-support] Re: Help for a single test in a function.

2009-09-23 Thread Francois Maltey
Many thanks Tim ! > If you simply copy-paste into the sage commandline, you will get that > error... > Last time I tried `sage.el`, there was a command to send input > directly to the comandline buffer... Perfect ! I pass the edited buffer to sage-mode in emacs, get then a new sage-send-region,

[sage-support] subtypes in an expression.

2009-09-24 Thread Francois Maltey
Hi, I get elements inside an expression as res=3*x*exp(x^2) by res.operands() and res.operator(). So I catch 3 or x or exp(x^2) by res.operands()[0 or 1 or 2]. But how can I test that the first one is an Integer without error ? The res._interger_() seems to accept to retract the expression 12

[sage-support] Re: expand, combine and rewrite with sage.

2009-09-25 Thread Francois Maltey
Hi Burcin, Many thanks for theses details about sage. I try to understand what you prefer, and why. > The main reason I left this simplification "exp(a)^2 to exp(2*a)" while > fixing #6948 was that MMA does things this way. All right : MMA is good. > Another consideration was that before pe

[sage-support] Re: How to simplify each term in a sum separately

2009-10-01 Thread Francois Maltey
ma...@mendelu.cz wrote : > Hello all, I am looking for the possibility how to simplify each term > in an expression separately. > > Consider > A=x/((x^2/y^2 + 1)*y) + arctan(x/y) > > I wish to get x*y/(x^2+y^2)+atan(x/y) , which can be produced in > Maxima by map(fullratsimp, A) > I feel this

[sage-support] Re: substitution

2009-10-08 Thread Francois Maltey
Ranjit a écrit : > I'm trying to figure out how to do a simple substitution. I've the > following code: > > var('r beta beta_0 R a h') > psi=function('psi',r) > sigma=function('sigma',r) > > H_0=function('H_0',r) > > H_grad = lambda psi : (1/2)*(beta/beta_0)*R^2*(psi.diff(r))^2 > H_0(psi) = -(1/2)

[sage-support] Re: [sage-support]how to collect the same items

2009-10-12 Thread Francois Maltey
Hello wxuyec, > The same expression, How can I want to get > > the coefficient of x^4*y? > The coefficient of the coefficient... try var('a b x y') res = expand ((a+b+x+y+1)^6) res.coefficient (x^4) res.coefficient (y) res.coefficient (x^4).coefficient(y) res.coefficient (y).coefficient(x^4)

[sage-support] Re: How group terms in an expression? maybe a bug ?

2009-10-12 Thread Francois Maltey
Hello, About this question, I test coefficient and collect. Is it a bug ? or is there a reason ? collect and coefficient don't have the same react : I take a line equation test = cos(a)*x+sin(a)*y-h # means ... == 0 test.coefficient(cos(a)) # are right test.coefficient(x) test.collect(x) t

[sage-support] Re: How group terms in an expression? maybe a bug ?

2009-10-12 Thread Francois Maltey
Thanks Mike, > You should check the version of Sage that you are using. The > SymbolicArithmetic class shouldn't exist after Sage 4.0. > I test again this morning, and it's right ! Indeed I have 3 sage(s) in my ubuntu box. The ubuntu one, an old version, the 4.1.2-a4 and my one with little p

[sage-support] Syntax misunderstanding in timeit.

2009-10-15 Thread Francois Maltey
Hello, I play with the timeit function because I want to test the asymptotic time of complexity for (pseudo-)lists in sage. I test timeit('n=5;[2*x for x in [1..10^n]]') This line is well evaluate and I get a linear answer when I change n from 2 to 7. I may add the parameter repeat=1 and num

[sage-support] Re: Negative Binomial?

2009-10-17 Thread Francois Maltey
Hello, >> Hi all, >> >> In sage, as of 4.1.1, binomial( -7, 1 ) returns -7. As I understand the >> definition of binomial, this should be 0, since there is no set with -7 >> elements. >> Sage (and others Computer Algebra System) gives 0 for binomial (n>=0, -1) or binomial(n,k>n). So "sum

[sage-support] How can I display a subwindow of a plot.

2009-10-25 Thread Francois Maltey
Hello everybody ! I run around plot and show and I want to display only a subwindow (x,y) in [-5,5]x[-5,5] of a plot even if y goes from -oo to +oo. For parametric_plot I need to cut both the x-axe and the y-axe. The figsize option doesn't seem the right one : the display is more or less large

[sage-support] Re: Factorize/collect a sub expression

2009-10-26 Thread Francois Maltey
mpad a écrit : > Hello everyone, > > I am new to sage (thanks for it ! it looks excellent !) and have been > trying to re-factor some long expressions. > As an example : > > sage: var('x,y,a,b,c,d') > (x, y, a, b, c, d) > sage: T=expand((x^2+y^2)*(a*b+a^2-2*d*c+c^2-3*b^2));T > a^2*x^2 + a^2*y^2 +

[sage-support] Re: Python lists and removals

2009-10-27 Thread Francois Maltey
Hello, I'm an old lisp-list user and python is my first use of dynamic array-list. Complexity for lisp-list is constant and fast o(1) when we add a new element at the head of the list. (cons e L) in Lisp or e::L in caml. Complexity is also o(1) when we take the end of the list, or read the fi

[sage-support] Re: plot3d can't handle log(0)

2009-11-17 Thread Francois Maltey
Hello, >> As a first pass, just surround the evaluation with a try/except, as >> you would in Python. Perhaps you could set the value in the except >> clause to nan. >> For the 2d-plot, I test if a result is a real number by theses tests : # # The real number without infty nor NaN=NotANumbe

[sage-support] Can I change a plot option ?

2009-11-25 Thread Francois Maltey
Hello everybody ! I'm using plot : I can plot a curve by sage: plot (sin(x), (x,-3,3)) or sage: res = plot (sin(x), (x,-3,3)) ; res I also can configure plot with optional parameters. plot (sin(x), (x,-3,3), aspect_ratio=1) And aspect_ratio is a method in res : I test it by res.[tab] But I

[sage-support] plot3d doesn't display.

2009-11-29 Thread Francois Maltey
Hello, I try to use the 3d plot but I can't. The first command is perfect. The second opens no new display and I can continue other calculus after. I use a sage 4.2 version in a emacs windows in gnome box. The distribution is an ubuntu. show( line([(1,2), (1,0), (3,1), (2,1)], color='red')) sh

Re: [sage-support] plot3d displays NOW !

2009-11-29 Thread Francois Maltey
This is the right reason : > ...with Ubuntu, the right package is > > apt-get install icedtea6-plugin > It's perfect. So Sage contains the other computer algebra systems, but calls other programs for graphic display. -- To post to this group, send email to sage-support@googlegroups.com To u

Re: [sage-support] Plotting....

2009-12-06 Thread Francois Maltey
Hello Laurent and Michel ! [Maybe french users...] >> I never have any luck with plotting in Sage. The simplest plots fail. >> For example the following >> >> plot(20*log(abs((1+I*x)^4+4),10),(x,0,3)) >> >> > The answer of this > f(x) = abs((1+I*x)**4+4) > f(1) > is 0. > > Then the logari

Re: [sage-support] Re: Plotting....

2009-12-07 Thread Francois Maltey
Hello, This bug feels very similar to 7614 (not 7165) and so 5572. http://trac.sagemath.org/sage_trac/ticket/7165 -- 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, vis

[sage-support] assume doesn't assume the first time (with limit)

2013-04-17 Thread Francois Maltey
Hello everyone, I must declare "assume" twice. First time, I get an unevalued form. After the second assume, I get the fine result : I use Sage 5.7 sage: forget () ; var('n') n sage: assume ((x<1) and (x>0)) ; limit (n*x^n*(1-x), n=oo) ; limit (n*x^n*(1-x), n=oo) -(x - 1)*limit(x^n*n, n, +I

[sage-support] fast_float (in plot) and usual eval are different.

2010-07-20 Thread Francois Maltey
Hello, I'm using Sage and try some months ago to plot a very long expression, and that fails ! (see http://trac.sagemath.org/sage_trac/ticket/7165) Today I test with the shorter command, and I get a NotANumber answer with fast_float used by plot. sage: var ('m') ; rr = abs (sqrt (m^2-1)) ;

[sage-support] the load command (from Sage) isn't the same in emacs and in a xterm.

2010-10-19 Thread Francois Maltey
Hello, When I use sage in a xterm I can load a source file with the *.sage name. sage: load ('In/This/Directory/MyFile.sage') # it's fine with and without parenthesis sage: # I continue my sage session Now I run sage in emacs with the sage-mode.el file. And with the same command I get an err

Re: [sage-support] Substituting variables from two different structures

2010-10-20 Thread Francois Maltey
Hi Alasdair, F.=GF(2^8,name='x') R.=PolynomialRing(Zmod(2)) p = F.random_element() p.subs(x=y) Basically, I have an object which is created as an element of a finite field, which I then need to treat as an element of a ring. If I try: pp = p.polynomial() pp.subs(x=y) And what do you think

Re: [sage-support] Python or Sage behavior? - List - tuple and iterator

2010-10-23 Thread Francois Maltey
Rolandb wrote : test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1) print [t for t in test] print [t for t in test] [(1, 2), (1, 3), (2, 3)] [] I begun to confuse lists L with [...] we can free change : one change one term by L[1]=123, and change the length by L[3:

Re: [sage-support] Re: Python or Sage behavior? - List - tuple and iterator

2010-10-24 Thread Francois Maltey
Jason Grout wrote : range() is a python function that creates python ints, which actually are arbitrarily big: and type changes around 2^31 : type (int (2^30)) == type (int (2^32)) == Thanks for all your tips, you are my teacher ! François -- To post to this group, send email to sage-suppo

Re: [sage-support] Finding cube roots in terms of parameters

2010-10-24 Thread Francois Maltey
vasu wrote : Hi all Suppose I have an positive integer parameter 't', and a polynomial Delta(t) , which is a polynomial in 't' with coefficients being integers. Assume we also know that Delta(t) > 0. There is another polynomial with integer coefficients , say F(t). Consider an expression [x(t)]

[sage-support] Round symbolic expressions

2010-10-26 Thread Francois Maltey
Cristóvão wrote : I propose a generic function mapexpression in order operate in the tree of the expression. You can use it over leaf (ie the numbers or the variables) or over functions (by the fctfct parameter) I like this function because we can use this same function for numerical transfo

[sage-support] All the subsets of a CartesianProduct.

2010-12-19 Thread Francois Maltey
Hello, I try to work with all the subsets of a cartesian product. So I begin with S = Set([1..4]) P = CartesianProduct (S) Subsets (S) # is right Subsets (P) # fails Am I wrong ? (CartesianProduct isn't a Set) or is it a bug in Sage ? Many thanks for your tips. Francois -- To post to this g

[sage-support] input by sage-mode.el in emacs fails, but input by xterm is right.

2010-12-19 Thread Francois Maltey
Hello, I use sage in emacs. I type the input inside the run shell buffer named *Sage-main*, in Inferior Sage mode. In an xterm this single function is right, but when I type the same input I get an error in emacs : In emacs : sage: def f1 (x) : : if x==1 : : return 1 .

[sage-support] timeit : a function with or without result ?

2011-01-08 Thread Francois Maltey
Hello, I play with the famous timeit function. I don't understand if this function sends a result or only gives a displayed text. I test : timeit ('2+3') # In these 2 cases Sage displays 625 loops... res=timeit ('2+3) # the res variable contains . The r

Re: [sage-support] How to reinitialize a generator.

2011-01-09 Thread Francois Maltey
thanks, I discover : sage: import itertools sage: it = sxrange(10^7) sage: (it1, it2) = itertools.tee (it) sage: ... play with it1.next() and it2.next() ... F. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+uns

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-15 Thread Francois Maltey
Hello, Any chance that we can add simplify_full on matrices? So that each element is simplified if possible? /1/ I suppose you know the map function that operate over each term of a list. map (lambda x: 3*x, [1,2,3]) # computes [3,6,9] # you can replace 3*x by the function simplify_what_y

Re: [sage-support] simplify_full on matrices.

2011-01-17 Thread Francois Maltey
Jason Grout wrote : And maybe also a reason for us to make things more discoverable. For example, I think changing M.apply_map() to M.map() would make it much easier to discover (or at least making M.map() an alias of M.apply_map()). Indeed I also don't think to look at matrix.apply_map() meth

Re: [sage-support] simplify ans sqrt

2011-01-26 Thread Francois Maltey
Loďc a écrit : Hello list, Version: sage 4.6.1 I'm quite a newbie with Sage but I'm really impressed this powerful software. Since an hour, I'm on a stupid problem: sage: sqrt(2)*sqrt(3) sqrt(2)*sqrt(3) sage: sqrt(2)*sqrt(3)-sqrt(6) sqrt(2)*sqrt(3)-sqrt(6) Test : sage (sqrt(6)).radical_simp

Re: [sage-support] help needed with cube

2011-01-29 Thread Francois Maltey
Hello, I was making some tries with 3D. I don't succeed to make cube correctly: Here is my code: c=cube((0,0,0),size=2,opacity=0.1,color='red') c+=point((2/3,2/3,0),color='green',size=10) c+=cube(center=(2/3,2/3,0),size=1/3,opacity=0.8) show(c) I draw a point with coord (2/3,2/3,0) Then I draw

Re: [sage-support] newbie: plotting sum of cosines...complex values?

2011-01-30 Thread Francois Maltey
Hello, I'd like to plot this function of x (latex code): x/2 + sum_{r=1}^n cos(rx) for some fixed n. //A// First, sum is designed for formal sum, not for truncate sum even if sometimes it's possible. But add is designed for these sums. Second, expression doesn't evaluate the add(...) funct

Re: [sage-support] newbie: plotting sum of cosines...complex values?

2011-01-30 Thread Francois Maltey
Hello Renato, def s(x,n) : return x/2 + add (cos(k*x) for k in [1..n]) n0 = 5; plot(s(x,n0),(x,0,pi)) Thanks for clarification and tips :) Just a last doubt: if I understand correctly, add() wants as argument an array like for example [1,2,7,5], but running cos(k*x) for k in [1..n] al

Re: [sage-support] Re: help needed with cube

2011-01-30 Thread Francois Maltey
Robert Bradshaw wrote : On Sun, Jan 30, 2011 at 2:55 AM, Loďc wrote: You're right, size affects the center too. Not very intuituive but now, I know it. I think this behaviour is quite surprising. For example, with sphere, size doesn't affect center I might go so far to call it a

Re: [sage-support] plot(): no ticks and arrow on axes?

2011-01-30 Thread Francois Maltey
Renato a écrit : Hello, I can't understand how the ticks option works in plot()... I want to have no ticks or labels on the axis. Also, is it possible to show the arrows on the axis? like this: http://www.homeschoolmath.net/blog/few-complex-numbers.gif I'm using latest version of sage Sear

Re: [sage-support] GF(2) -Grobner Basis - How to force x^2 = x ?

2011-02-03 Thread Francois Maltey
Thomas Gueuning wrote : When I use this code, I don't understand why y^3 is still there because I think this is equal to y for both 0 and 1. So why the Groebner basis is [y^3 + y, x^2 + y^2 + 1, x*y] and not [x+y+1,x*y], which should be reduced to [x+y+1]. I tried to add a modulus but it does'

Re: [sage-support] GF(2) -Grobner Basis - How to force x^2 = x ?

2011-02-04 Thread Francois Maltey
Dear Martin, Many thanks for these explanations... They point exactly what I was looking for. a very last question : Is there a link between ring structure GF(2)[a,b,c] / (a^2-a, b^2-b, c^2-c) where + == xor and * == and and Boolean predicates over variables a, b, c with operators "or == |"

Re: [sage-support] Problems with taylor expansion and formal symbolic functions

2011-02-04 Thread Francois Maltey
C. Kelly wrote : I define the following one-parameter functions and their derivatives x,y,l,L = var('x,y,l,L') d5 = function('d5',nargs=1) def d3partderiv(self,*args,**kwds): arg = args[0]; return L*L*d5(arg); d3 = function('d3',derivative_func=d3partderiv) def d1partderiv(self,*args,**kwds):

Re: [sage-support] Problems with taylor expansion and formal symbolic functions

2011-02-04 Thread Francois Maltey
Hello, I came back... I define the following one-parameter functions and their derivatives x,y,l,L = var('x,y,l,L') d5 = function('d5',nargs=1) def d3partderiv(self,*args,**kwds): arg = args[0]; return L*L*d5(arg); d3 = function('d3',derivative_func=d3partderiv) def d1partderiv(self,*args,**k

Re: [sage-support] Problems with taylor expansion and formal symbolic functions

2011-02-05 Thread Francois Maltey
Again... Look at diff code by differentiate??, You read at the end of the file that sage call derivative. Search in x.derivative?? , there is a methode x._derivative?? I feel that only sage manages the rewrite rules in diff. Now browse into taylor?? source, and you see that sage call the tay

Re: [sage-support] Integration

2011-02-07 Thread Francois Maltey
Santanu Sarkar a écrit : How one can find integral abs(cos(x+y)) where x varies from 0 to pi and y varies from 0 to pi in Sage? You must help Sage (in fact Maxima bellow) for these integrals. cos(x+y) >= 0 for 0 <= x+y <= pi/2 or 3*pi/2 <= x+y <= 2*pi cos(x+y) <= 0 for pi/2 <= x+y <= 3*pi/2

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

2011-02-10 Thread Francois Maltey
achrzesz wrote : 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 sa

[sage-support] fuzzy (-1)^(1/3)

2011-02-13 Thread Francois Maltey
Andrzej Chrzeszczyk finds this numerical error in this equation : 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]

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

2011-02-21 Thread Francois Maltey
achrzesz wrote : 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_

Re: [sage-support] exp(I*x) --> cos(x)+I*sin(x)

2011-03-27 Thread Francois Maltey
Dmitry Shkirmanov a écrit : Hello, list, i need a function that can exp(I*x) --> cos(x)+I*sin(x) At http://wiki.sagemath.org/symbolics/rewrite i found the rewrite function. But this function is not mentioned in Sage reference manual, and Sage 4.6.2 does not know this function: NameError: name 're

Re: [sage-support] Expand complex exponential using eulers formula

2011-06-30 Thread Francois Maltey
ObsessiveMathsFreak wrote : I have complex formulas involving several occurances of complex exponentials. e.g. e^(2*I*theta), e^(3*I*theta) I would like to find the real part of the expression (there are several variables), but when I do so, the expression becomes unwieldy with a lot of terms li

Re: [sage-support] Re: simplify problem

2011-07-08 Thread Francois Maltey
John Cremona describes an use of the algebraic QQbar domain : Then I test a=sqrt(2)-sqrt(3) b=sqrt(3)-sqrt(2) QQbar(a).minpoly() ; QQbar(b).minpoly() # seems right. The same even polynom. But the test and the numerical values are True. I get +0.31 in both cases. QQbar(a)==QQbar(b) This me

Re: [sage-support] function of vector variables

2011-07-08 Thread Francois Maltey
What do you think about the format % operator : add([var("x%02d" % k) for k in [0..11]])# creates 11 variables x00 to x11, and adds it v1=vector ([var("x%02d" % k) for k in [0..11]]) v2=vector ([var("x%02d" % k) for k in [0..11]]) v1==v2 # is true. -- To post to this group, send email to

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

2011-10-05 Thread Francois Maltey
Hello, A map command seems also right : sage: [f0, f1] = map (lambda n: lambda x: bessel_J(n,x),[0,1]) ; f0(0);f1(0) 1.00 0.000 In the command [lambda x: n*x for n in [0..1]] there is a variable n in the for list, and questions about its value (a dalayed evaluation,