[sage-support] Re: simplification options

2019-03-11 Thread Simon King
Hi Michael, On 2019-03-11, Michael Beeson wrote: > I tried various simplification functions.I suppose I could start over, > not using "symbolic expressions" but > declaring K to be a suitable field or ring, maybe a quadratic extension of > the field of rational functions in a. > That is

[sage-support] Re: simplification options

2019-03-11 Thread Eric Gourgoulhon
Le lundi 11 mars 2019 19:05:04 UTC+1, Michael Beeson a écrit : > > I appreciate Eric's post, and I do use subs sometimes, but it makes me > nervous since > it will happily substitute any old thing you tell it to, even an > incorrect thing. So, if your idea > is to check a computation, it

[sage-support] Re: simplification options

2019-03-11 Thread Nils Bruin
On Monday, March 11, 2019 at 11:05:04 AM UTC-7, Michael Beeson wrote: > > I appreciate Eric's post, and I do use subs sometimes, but it makes me > nervous since > it will happily substitute any old thing you tell it to, even an > incorrect thing. So, if your idea > is to check a

[sage-support] Re: simplification options

2019-03-11 Thread Michael Beeson
I appreciate Eric's post, and I do use subs sometimes, but it makes me nervous since it will happily substitute any old thing you tell it to, even an incorrect thing. So, if your idea is to check a computation, it is a dangerous thing. True, if you put only correct equations in,

[sage-support] Re: simplification options

2019-03-11 Thread Eric Gourgoulhon
What about something like sage: var('p,q,r,a') (p, q, r, a) sage: b = sqrt(1-a^2) sage: eq = (p*a+r*b+q)^2 sage: eq = eq.expand(); eq a^2*p^2 - a^2*r^2 + 2*sqrt(-a^2 + 1)*a*p*r + 2*a*p*q + 2*sqrt(-a^2 + 1)*q*r + q^2 + r^2 sage: b = var('b') sage: eq.subs({sqrt(1-a^2): b}) a^2*p^2 + 2*a*b*p*r -

[sage-support] Re: simplification of symbolic expressions

2013-11-24 Thread Robert Dodier
On 2013-11-22, John Cremona john.crem...@gmail.com wrote: 1. It is a fact that if a^2+b^2=1 then arcsin(a)+arcsin(b)=pi/2, but how can I get this to happen automatically? I have an expression which comes out as arcsin(1/3*sqrt(3)*sqrt(2)) + arcsin(1/3*sqrt(3)) which I would like to get

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-22 Thread Mark Rahner
On Feb 22, 2:37 am, JamesHDavenport j.h.davenp...@bath.ac.uk wrote: Canonical form and simplify aren't the same thing (necessarily). See Carette,J., Understanding Expression Simplification.  Proc. ISSAC 2004 (ed. J. Gutierrez), ACM Press, New York, 2004, pp. 72-79. I don't have access to that

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-22 Thread JamesHDavenport
Try http://www.cas.mcmaster.ca/~carette/publications/simplification.pdf The real point is that GiNaC's canonical form has different goals from a 'simplify' command in the sense of minimal complexity. One really needs to separate the two, and I don;t know how easy that is with the current design.

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-21 Thread Mark Rahner
So once it comes back to Sage, its internal representation goes back to the Ginac one. Doh! So much for a possible workaround involving maxima. Dox, I was using full_simplify() and also the handful of simplify methods it invokes.  Evaluate a.full_simplify? to see their names. Nils, trivial

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-21 Thread JamesHDavenport
On Feb 21, 9:36 pm, Mark Rahner rah...@alum.mit.edu wrote: So once it comes back to Sage, its internal representation goes back to the Ginac one. My initial problem was the severe obfuscation that resulted when extra factors added by the canonical form refused to cancel and then replicated

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-20 Thread kcrisman
On Feb 18, 8:24 pm, Mark Rahner rah...@alum.mit.edu wrote: I appreciate that background info.  I hadn't tried invoking maxima because I read somewhere that simplify() used maxima.  I must've been reading outdated material.  As you stated, maxima does the correct thing.  Because Sage can

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-20 Thread Nils Bruin
On Feb 18, 5:24 pm, Mark Rahner rah...@alum.mit.edu wrote: converts 1/sqrt(5) to 1/5*sqrt(5) so I suspect that this issue can be traced to the GiNaC canonical form. Yes, it does so for a very good reason: By simplifying expressions this way, you're sure to recognize equal expressions. Compare

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-18 Thread Mark Rahner
I appreciate that background info.  I hadn't tried invoking maxima because I read somewhere that simplify() used maxima.  I must've been reading outdated material.  As you stated, maxima does the correct thing.  Because Sage can invoke maxima, perhaps I have a work around. You're right that this

[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-17 Thread kcrisman
In some previous incarnation, where Sage used Maxima for things like this, your simplification happened. (%i1) 1/sqrt(5); 1 (%o1) --- sqrt(5) (%i2) sqrt(5)/5;

[sage-support] Re: Simplification / Latex question

2010-06-30 Thread kcrisman
As far as I understand from your previous comments, a way to extract the exponential functions from the expression is all you need. You don't really need to walk through the tree. Here is one way to do this: sage: t = exp(x+y)*(x-y)*(exp(y)+exp(z-y)) sage: t (e^(-y + z) + e^y)*(x - y)*e^(x

[sage-support] Re: Simplification / Latex question

2010-06-26 Thread Jason Grout
On 6/24/10 6:15 AM, kcrisman wrote: Right. This crops up in the middle of a more complicated expression. If I could figure out how to break the expression up in the right way, then I guess I could search for parts that are exponential functions, take the log of those, and then simplify the

Re: [sage-support] Re: Simplification / Latex question

2010-06-26 Thread Mike Witt
On 06/26/2010 03:26:06 PM, Jason Grout wrote: On 6/24/10 6:15 AM, kcrisman wrote: Right. This crops up in the middle of a more complicated expression. If I could figure out how to break the expression up in the right way, then I guess I could search for parts that are exponential functions,

[sage-support] Re: Simplification / Latex question

2010-06-26 Thread kcrisman
I believe that Ticket #9329 was generated in response to my original post, before I understood that there was a Latex issue involved. I believe that Ticket #9329 should be deleted (closed or whatever). But part of your question was also to try to simplify more complicated expressions, and it

Re: [sage-support] Re: Simplification / Latex question

2010-06-26 Thread Mike Witt
On 06/26/2010 05:21:21 PM, kcrisman wrote: I believe that Ticket #9329 was generated in response to my original post, before I understood that there was a Latex issue involved. I believe that Ticket #9329 should be deleted (closed or whatever). But part of your question was also to try to

[sage-support] Re: Simplification / Latex question

2010-06-25 Thread kcrisman
Dear Mike, Just to follow up: There is further discussion at http://trac.sagemath.org/sage_trac/ticket/9329 if you are interested in saying exactly what sort of data structure would enable you to perform the simplifications you would like to without having to create a custom Maxima

Re: [sage-support] Re: Simplification / Latex question

2010-06-25 Thread Mike Witt
On 06/25/2010 06:07:02 AM, kcrisman wrote: Dear Mike, Just to follow up: There is further discussion at http://trac.sagemath.org/sage_trac/ticket/9329 if you are interested in saying exactly what sort of data structure would enable you to perform the simplifications you would like to

[sage-support] Re: Simplification / Latex question

2010-06-24 Thread kcrisman
sage: n=var('n') sage: f=e^(i*x*pi*n-i*2*pi*n) sage: f.simplify_full() e^(I*pi*n*x - 2*I*pi*n) # Is there a way I can get this to simplify? This apparently isn't even that easy in Maxima. Maxima 5.21.1http://maxima.sourceforge.net using Lisp ECL 10.4.1 Distributed under

Re: [sage-support] Re: Simplification / Latex question

2010-06-24 Thread Mike Witt
On 06/24/2010 06:15:52 AM, kcrisman wrote: sage: n=var('n') sage: f=e^(i*x*pi*n-i*2*pi*n) sage: f.simplify_full() e^(I*pi*n*x - 2*I*pi*n) # Is there a way I can get this to simplify? This apparently isn't even that easy in Maxima. Maxima

[sage-support] Re: Simplification / Latex question

2010-06-24 Thread kcrisman
I've noticed too about how maxima continues to ask things that (it would seem) you have already told it. I guess it would be in my best interests to learn more about maxima. If you are serious about doing symbolic manipulation that you can control from within Sage, yes. That said, various

Re: [sage-support] Re: Simplification / Latex question

2010-06-23 Thread Mike Witt
On 06/22/2010 12:41:17 PM, kcrisman wrote: sage: n=var('n') sage: f=e^(i*x*pi*n-i*2*pi*n) sage: f.simplify_full() e^(I*pi*n*x - 2*I*pi*n) # Is there a way I can get this to simplify? This apparently isn't even that easy in Maxima. Maxima 5.21.1 http://maxima.sourceforge.net using Lisp

[sage-support] Re: Simplification / Latex question

2010-06-22 Thread kcrisman
sage: n=var('n') sage: f=e^(i*x*pi*n-i*2*pi*n) sage: f.simplify_full() e^(I*pi*n*x - 2*I*pi*n) # Is there a way I can get this to simplify? This apparently isn't even that easy in Maxima. Maxima 5.21.1 http://maxima.sourceforge.net using Lisp ECL 10.4.1 Distributed under the GNU Public

[sage-support] Re: Simplification

2009-05-14 Thread mabshoff
On May 14, 3:57 am, Laurent moky.m...@gmail.com wrote: Hello Hi Laurent, x,y=var('x,y') s = x*y2 + x*(-y2 - x2 + 1) + x3 - x print simplify(s) Answer :                            2         2    2         3                         x y  + x (- y  - x  

[sage-support] Re: Simplification

2009-05-14 Thread simon . king
Dear Laurent, On May 14, 12:57 pm, Laurent moky.m...@gmail.com wrote: Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. Yes. simplify_full is not a function but a method (after all, python is object oriented). So, you can do: sage: x,y=var('x,y')

[sage-support] Re: Simplification

2009-05-14 Thread Robert Bradshaw
On May 14, 2009, at 3:57 AM, Laurent wrote: Hello x,y=var('x,y') s = x*y2 + x*(-y2 - x2 + 1) + x3 - x print simplify(s) Answer : 2 22 3 x y + x (- y - x + 1) + x - x

[sage-support] Re: Simplification

2009-05-14 Thread Laurent
On May 14, 12:57 pm, Laurent moky.m...@gmail.com wrote: Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. Yes. simplify_full is not a function but a method (after all, python is object oriented). Thanks all. Indeed, simplify_all(s)

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread Tim Lahey
On Nov 24, 2008, at 8:45 PM, William Stein wrote: On Mon, Nov 24, 2008 at 4:46 PM, Tim Lahey [EMAIL PROTECTED] wrote: Hi, Is there a specific way to add rules (and apply them) to rewrite expressions in Sage? Such as, log(a)-log(b) = log(a/b) I need this (and others) in order to

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread William Stein
On Mon, Nov 24, 2008 at 6:03 PM, Tim Lahey [EMAIL PROTECTED] wrote: On Nov 24, 2008, at 8:45 PM, William Stein wrote: On Mon, Nov 24, 2008 at 4:46 PM, Tim Lahey [EMAIL PROTECTED] wrote: Hi, Is there a specific way to add rules (and apply them) to rewrite expressions in Sage? Such as,

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread Tim Lahey
On Nov 24, 2008, at 9:05 PM, William Stein wrote: I can easily run timing comparisons between maxima and FriCAS, but because of how sympy does things (with its separate variables), I'll have to run them separately. Comparing maxima and FriCAS, the timings are pretty close on both for

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread mabshoff
On Nov 24, 6:17 pm, Tim Lahey [EMAIL PROTECTED] wrote: On Nov 24, 2008, at 9:05 PM, William Stein wrote: Hi, I can easily run timing comparisons between maxima and FriCAS, but because of how sympy does things (with its separate variables), I'll have   to run them separately.

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread Tim Lahey
On Nov 24, 2008, at 9:21 PM, mabshoff wrote: We have a timeit doctest framework that is supposed to hunt for speed regressions. It is merged in 3.2, but we need infrastructure to compare the output from several runs. But I guess you are asking if timeit('foo') could return the time so

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread Mike Hansen
On Mon, Nov 24, 2008 at 6:31 PM, Tim Lahey [EMAIL PROTECTED] wrote: I know I could parse the output, but I thought someone might have done it and it sounds like the timeit doctest framework might do it. Where can I find this in the source so I can see how it is doing it? You can do this in

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread mabshoff
On Nov 24, 7:03 pm, Tim Lahey [EMAIL PROTECTED] wrote: On Nov 24, 2008, at 9:51 PM, Mike Hansen wrote: You can do this in 3.2: sage: s = timeit.eval(2+3) sage: s 625 loops, best of 3: 942 ns per loop sage: s.stats (625, 3, 3, 942.230224609375, 'ns') The code is in

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread Tim Lahey
On Nov 24, 2008, at 10:07 PM, mabshoff wrote: You should consider creating one or a couple large files with the integrals for doctesting and stuff them into $SAGE_ROOT/devel/tests. Hopefully it can be arranged to feed the input into Maxima/Axiom/ Maple/ MMA/sympy and so on and compare the

[sage-support] Re: Simplification/Rewrite Rules?

2008-11-24 Thread William Stein
On Mon, Nov 24, 2008 at 6:17 PM, Tim Lahey [EMAIL PROTECTED] wrote: On Nov 24, 2008, at 9:05 PM, William Stein wrote: I can easily run timing comparisons between maxima and FriCAS, but because of how sympy does things (with its separate variables), I'll have to run them separately.