Re: [sage-devel] Re: Failed tests for accuracy reasons

2011-03-17 Thread Francois Maltey
Hello, What if we introduce a # numeric 1e-10 doctest flag (like #optional, etc.) that does just that---reads in the doctest answer, gets the output of the function, and does an abs(actual-expected) epsilon (where epsilon can be specified in the flag, or it has a default). sage:

Re: [sage-devel] Series expansion.

2011-02-18 Thread Francois Maltey
Dox ask : I'd like to know if there is a way of finding the series expansion of a given function around zero and infinity. Around 0 : sage: taylor (2*x/sinh(2*x), x, 0, 10) -292/13365*x^10 + 254/4725*x^8 - 124/945*x^6 + 14/45*x^4 - 2/3*x^2 + 1 I see that the serie is right, even if partial

Re: [sage-devel] Coercion between polynomial rings

2011-02-16 Thread Francois Maltey
mmarco a écrit : Dealing with polynomial ringsi found something that seems incorrect sage: R=QQ['x','y'] sage: S=QQ['x']['y'] Shouldn't there be natural coercions from rings like QQ[x,y][z] or QQ[x][y][z] to QQ[x,y,z] and vice-versa? One easy way to coerce is Domain(the-expression)

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

[sage-devel] a maxima? bug in sum.

2011-01-24 Thread Francois Maltey
Hello, I test sage: var ('n,k') sage: sum (binomial(n,k)*k^2, k, 0, n) # seems right sage: sum (binomial(n,k)*k^2, k, 1, n) # seems right n(n+1)2^(n-2) sage: sum (binomial(n,k)*k^2, k, 2, n) # is false : I get 0 Is it a maxima bug ? Do I push a Sage ticket for it ? F. -- To post to this

Re: [sage-devel] Transforming exponentials to hyperbolic functions.

2011-01-23 Thread Francois Maltey
Dox a écrit : Hi guys! I have an easy question... got an expression with exponentials, say exp(x)+exp(-x), How can I get the result in terms of hyperbolic functions 1/ First you can use the expr.subs method : y=exp(x)+exp(-x) y.subs(exp(x)==sinh(x)+cosh(x)).subs(exp(-x)=cosh(x)-sinh(x)) [You

Re: [sage-devel] Simplification of symbolic sums and Maxima simpsum option

2011-01-17 Thread Francois Maltey
Hello Jean-Pierre, It would be nice to add an option to set Maxima simpsum option when calling Sage symbolic_sum function, or to enable it by default. Indeed, without it Maxima (and so Sage) does not evaluate symbolic sums of sums, i.e. something as sage: var('n') n sage: sum(2^x+2^-x,x,0,n)

[sage-devel] Tests of improvements in timeit

2011-01-17 Thread Francois Maltey
Hello, I plot and analyse timeit (a-calculus(n)) in a log-log scale from n=1..to..10..100..10^5...even...10^6 and I find some curious features in timesit, so I post these remarks and questions : /1/ I get the timeit result by timeit.eval(string_2+2).stats but timeit(string_2+2) displays a

Re: [sage-devel] desired behavior on #optional with ellipses

2011-01-17 Thread Francois Maltey
Dear kcrisman, While reviewing #7981, I discoverd something a little interesting. sage: animate([plot(sin(x + float(k)), (0, 2*pi), ymin=-5, ymax=5) ...for k in srange(0,2*pi,0.3)]).show() # optional You'd think this would be optional. Nope - it creates a file in doctesting. I

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

Re: [sage-devel] Re: Riemann sums , trapezoid mode

2011-01-11 Thread Francois Maltey
Hello, (and copy to Sage-edu) Currently, both riemann_sum and riemann_sum_integral_approximation does not support trapezoid mode. But instead there are separate function which computes these for trapezoid mode . I am added this mode to both riemann_sum and

Re: [sage-devel] translating, transforming graphics objects?

2010-12-22 Thread Francois Maltey
Hi, I would like something like this to work: L = line([ some 2d points ]) L.translate(1, -1) I don't find how to transform a line to a list of points. But L[0] seens almost right (when L is a line) You apply the function lambda (x,y):(x+1,y+1) to each point. So map

[sage-devel] emacs, prompt and readline

2010-12-21 Thread Francois Maltey
Hi, I use Sage in emacs in the shell buffer named *Sage-main*, in Inferior Sage Mode. I get an error when I type this input bellow with indent spaces. But the input is right without any indent space. In a xterm Sage adds theses spaces after the prompt, so I type the indented code without any

Re: [sage-devel] Re: emacs, prompt and readline

2010-12-21 Thread Francois Maltey
are welcome ! Francois Maltey (in France) I use ; GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.16.1) of 2010-03-26 on palmer, modified by Ubuntu The sage part in my .emacs file : (add-to-list 'load-path (expand-file-name /usr/local/sage-4.1.1-test/data/emacs)) (require 'sage-view sage

Re: [sage-devel] Re: Renaming the debugging function trace() to trace_execution()

2010-11-14 Thread Francois Maltey
Dear all, Students discover Sage for mathematical computations, and the functions are the most usual way to write mathematics. So I prefer a light interface with the matrix function trace(...). The determinant is a function and a method... but trace is only a method. And .methods() aren't

Re: [sage-devel] sqrt() returns wrong result for large inputs

2010-10-26 Thread Francois Maltey
David Roe wrote : I posted a patch there that should fix it; I have to work on other stuff, but if someone else wants to take over and write some doctests, make sure it works in lots of cases... David On Mon, Oct 25, 2010 at 17:14, Burcin Erocal bur...@erocal.org mailto:bur...@erocal.org

Re: [sage-devel] sqrt() returns wrong result for large inputs

2010-10-25 Thread Francois Maltey
Georg wrote : while calculating the integer part of square roots I realized that sqrt() returns wrong results for large inputs (although the sqrt() command itself accepts bignum values). example: int(sqrt(2^94533)) int isn't a mathematical Sage type, but Integer is a Sage type. And Integer

Re: [sage-devel] Re: log(1) returns int, not Integer

2010-10-15 Thread Francois Maltey
Hi Karl-Dieter and Burcin, You wrote (I cut a lot) Yup, I see what you are talking about - e.g. if (x.is_equal(_ex1)) // log(1) - 0 return _ex0; Although it might be nice to stay relatively close to Ginac and fix such things on the Sage level if that's

Re: [sage-devel] Re: Test the log function in an expression for a rewrite function.

2010-10-11 Thread Francois Maltey
Hi Burcin and Karl-Dieter, // 1 // And what do you think about log ? Look at these test : exp(x).operator() == exp # is True, and all(?) trigonometric functions are fine log(x).operator() == ln # is True, yes the alias ln is better than the log name log(x).operator() == log # is False (this

[sage-devel] Test the binomial function in an expression

2010-10-07 Thread Francois Maltey
Hello, I play with expressions, and transform sin(x) to (exp(i*x)-exp(-i*x))/2. So I use a lot of test as var ('x') y = cos(x) # or any other expression op = y.operator # so op == cos if op == cos : ... # this test is fine, not the next one else : ... Now I want to test an expression

Re: [sage-devel] Re: Test the binomial function in an expression

2010-10-07 Thread Francois Maltey
dagss wrote : op = y.operator # so op == cos if op == cos : ... # this test is fine, not the next one Now I want to test an expression with the binomial function call. y = binomial (3*x, x)# is fine op = y.operator() # is also fine Why is there a () here, but not in the

[sage-devel] 1==0 with eval, sqrt and imag.

2010-07-22 Thread Francois Maltey
Hello, Maybe I'm wrong, but I don't understand the last 0. Test : var('m') ; y=sqrt(m^2-1) y(m=0) # =I, is right imag(y)# = feels right, arctan2(0,-1)=pi when m=0 imag(y(m=0)) # =1, is right (imag(y))(m=0) # is 0 and I don't understand why ! Francois in France. -- To

[sage-devel] A curious result with len : an int is not an Integer.

2010-05-04 Thread Francois Maltey
Hello, I play with random in order to approximate Pi by Monte-Carlo method. sage: n=10^5 ; len(filter(lambda t:t, [random()^2+random^2() 1 for k in [1..n]])) / len([1..n]) The test looks at the point (random(), random()) and tests if it's in the quarter circle. The result may be about

Re: [sage-devel] Re: Bug in determinant?

2009-11-25 Thread Francois Maltey
Sebastian Pancratz wrote : The problem is here: http://trac.sagemath.org/sage_trac/attachment/ticket/6441/trac_6441_b_df_charpoly_412rebase.patch new lines 1084--1089 When I wrote the code for computing characteristic polynomials in a division-free way in order for it to work over

[sage-devel] Re: Adding new functions for specific tasks related (logarithm, rational functions, ....)

2009-11-14 Thread Francois Maltey
Hello, This purpose about expression has 3 differents aspects. A/ The first aspect we discover is the user interface. This interface must be coherent. This means that 1/ it's possible to describe it with few word 2/ The most common calculus has no option 3/ This system will be able to be

[sage-devel] Re: Adding new functions for specific tasks related (logarithm, rational functions, ....)

2009-11-14 Thread Francois Maltey
William wrote : But isn't it just operator()??? sage: var('x,y'); a = x+y (x, y) sage: a.operator() built-in function add Sage also need tests over theses operators : In an expression we test op = expr.operator if op == sin : ... # is right elif op == + : ... # doesn't work (or add or

[sage-devel] Re: Adding new functions for specific tasks related (logarithm, rational functions, ....)

2009-11-14 Thread Francois Maltey
Many thanks for the 2 previous help ! About operator.add and expr.variables()... The (real-?) last question is a=4*x b=4/3*x c=4.0*x d=4*I*x I can get the constant by a.operands(), a.operands()[-1], but how can I test (without error) if this term is an integer, a rational, a float or a

[sage-devel] Re: slightly confusing pynac simplification

2009-11-14 Thread Francois Maltey
Jason wrote : The calculation below caused some concern for a few minutes with one of my students the other day. We reasoned through it and saw that everything was mathematically correct, but it seemed odd that Sage/pynac would automatically pull a negative one out of (x-2t) and square

[sage-devel] Re: Adding new functions for specific tasks related (logarithm, rational functions, ....)

2009-11-12 Thread Francois Maltey
a few conceptually defined methods like rewrite(), expand () and combine()( or contract()?). Francois Maltey had a proposal for a possible interface to all this. Maybe he can comment here, or we can discuss his proposal on sage- devel. -- It would be great

[sage-devel] Re: A plot may have several branchs

2009-10-27 Thread Francois Maltey
kcrisman wrote It would also be great to see how to integrate your ideas with #6878, which probably should still stand alone as a ticket since one might wish to exclude points for reasons other than asymptotes or jumps. Why not try to make this patch within the current plot code... I study

[sage-devel] A plot may have several branchs

2009-10-26 Thread Francois Maltey
Hello, I test the plot command, decode the plot.py file and also follow the patch #6878. So I understand that a plot is one line between points. The exclude option seems to cut this lines at each break point after the computation. Of corse a continuous plot is a such line. But the plot result

[sage-devel] Re: Decimals of Pi

2009-10-22 Thread Francois Maltey
Hello Nathann, I know this is totally useless, but why shouldn't it work nevertheless ? :-) sage: n(pi,digits=1000) Useless indeed... Maple often fails between 10^4 and 10^5 digits and axiom around 10^5. I don't know the reason : Ligther mathematics or bad code. It seems that numerical

[sage-devel] Re: 0^0

2009-10-22 Thread Francois Maltey
About 0^0 Even for discrete things like elements of GF(5)? I haven't thought about what 0^0 is for things where the continuous limit doesn't make sense. In any ring, integer power x^n is défined by x^0 = 1, because an empty product is the unit element. The reason is the same for 0!=1.

[sage-devel] Numerical discont for plot ?

2009-10-16 Thread Francois Maltey
Hello, Functions plot is fine with singular functions as plot (sin(1/x), x, 0, 5) Plot has also a symbolic option detect_poles=True. But this option isn't designed for theses plots. There are unpleasant vertical lines. plot (floor(10*x), x, 0, 2) plot (x*floor(1/x), x, 0, 2) plot (arctan

[sage-devel] imaginary and plot - an other error after the patch 6905 in sage 4.1.2 alpha 4

2009-10-03 Thread Francois Maltey
Hello ! I test with success : var('m') plot (m^2,m,0,6) # for one plot plot ([m^3],m,0,6) # for one plot plot(sqrt(m^2+1),m,0,6) plot([sqrt(m^2+1)],m,0,6) plot(real (sqrt(m^2+1)),m,0,6) They are all right But this one fails : plot([real (sqrt(m^2+1))],m,0,6) Of corse I don't want to plot

[sage-devel] Re: Sage 4.1.2.alpha4 released

2009-09-28 Thread Francois Maltey
I run upgrade from a sage-4.1.1 built at home on an ubuntu jaunty with a dual-core pentium by ./sage -upgrade http://sage.math.washington.edu/home/mvngu/release/upgrade/sage-4.1.2.alpha4 Then I get an error with an unknown function PC when I ran the updated sage. The ticket #6990 gives a new

[sage-devel] Call pyginac functions in sage.

2009-09-28 Thread Francois Maltey
Hello, If I am right, the symbolic manipulations of Sage come from the (py)ginac librairies. In ginac documentation I find very intersting functions for my use of expressions : is_anumeric is_areal is_arational There are about 30 tests for possible types. The types I can test by

[sage-devel] Re: Notebook feature request

2009-09-27 Thread Francois Maltey
Maurizio wrote : At the beginning of the worksheet I could write in a cell something like: a,b = any live data So, three cells later I have: c = a + b; c And whenever I update a or b, the evaluation of that cell is repeated and c gets updated accordingly... With students all cells will

[sage-devel] Where can I find the inner sage code ?

2009-09-23 Thread Francois Maltey
Hi, I'm testing sage, the expressions and I play with expr.expand(). After test = 3*x, I find test.expand? and get the help text, and test.expand?? and the main call about expand. Then emacs goes to expression.pyx at the lines defining the interface (outer) function expand. In this code I

[sage-devel] Re: the Sage notebook

2009-09-20 Thread Francois Maltey
Hi, I'm not sure that discuss about the interface design of sage notebook inside firefox is at the right place. But let me give my advise during the first uses of sage 2 weeks ago or forget this mail. Even if I also use sage.el in emacs, the web-interface is really a very great-great-great

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-18 Thread Francois Maltey
Hello, sage: a = RIF(1.5,2.3) I see no way to easily get 1 2 or 3 from a. I propose, but I'm perhaps missunderstanding. a.lower().floor() a.upper().ceil() a.center().round() François --~--~-~--~~~---~--~~ To post to this group, send an email to

[sage-devel] Re: round(), floor() and ceil() on interval objects

2009-09-17 Thread Francois Maltey
William Stein wrote : 2009/9/17 Jason Grout jason-s...@creativetrax.com: Currently, round(), floor(), and ceil() on interval objects return intervals. There is a patch up at #2899 that changes these functions to return integers (round- round the midpoint, floor - largest integer below

[sage-devel] Re: log(x) versus ln(x)

2009-09-07 Thread Francois Maltey
mirko wrote : Would it be possible to support both ln(x) and log(x), tg(x) and tan (x) and so on via a locale setting? If one locale is selected log, tan and so on, will be used, if another that ln, tg, etc. The input and the output must be the same, even in tex output and help files. An