ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 27 Apr 2020 22:51:07 +0200Simplification failshttps://ask.sagemath.org/question/51052/simplification-fails/1) I have tried nearly all simplification methods, expansion, factorization, collect... on the following code for `Ra1`
var("x,a")
Ra1 = -diff(x^a, x,2)/diff(x^a, x)
show(Ra1)
but the self-evident simplification doesn't work. I wonder why. I also have tried to add assumption even I do not see why since it's only algebra
2) Is there a way to ask SM to factor on a variable ?Mon, 27 Apr 2020 11:18:46 +0200https://ask.sagemath.org/question/51052/simplification-fails/Answer by slelievre for <p>1) I have tried nearly all simplification methods, expansion, factorization, collect... on the following code for <code>Ra1</code></p>
<pre><code>var("x,a")
Ra1 = -diff(x^a, x,2)/diff(x^a, x)
show(Ra1)
</code></pre>
<p>but the self-evident simplification doesn't work. I wonder why. I also have tried to add assumption even I do not see why since it's only algebra</p>
<p>2) Is there a way to ask SM to factor on a variable ?</p>
https://ask.sagemath.org/question/51052/simplification-fails/?answer=51058#post-id-51058The first question is about simplyfing a symbolic expression.
The method `simplify_log` seems to do the trick.
sage: x, a = SR.var('x a')
sage: Ra1 = -diff(x^a, x,2)/diff(x^a, x)
sage: Ra1
-(a - 1)*x^(a - 2)/x^(a - 1)
sage: Ra1.simplify_log()
-(a - 1)/x
I suppose the second question is about SageManifolds, but I'm not sure exactly what the question is.
Maybe this can help:
- Apply a function to all components of a tensor field
https://trac.sagemath.org/ticket/29244Mon, 27 Apr 2020 15:19:32 +0200https://ask.sagemath.org/question/51052/simplification-fails/?answer=51058#post-id-51058Comment by Masacroso for <p>The first question is about simplyfing a symbolic expression.</p>
<p>The method <code>simplify_log</code> seems to do the trick.</p>
<pre><code>sage: x, a = SR.var('x a')
sage: Ra1 = -diff(x^a, x,2)/diff(x^a, x)
sage: Ra1
-(a - 1)*x^(a - 2)/x^(a - 1)
sage: Ra1.simplify_log()
-(a - 1)/x
</code></pre>
<p>I suppose the second question is about SageManifolds, but I'm not sure exactly what the question is.</p>
<p>Maybe this can help:</p>
<ul>
<li>Apply a function to all components of a tensor field
<a href="https://trac.sagemath.org/ticket/29244">https://trac.sagemath.org/ticket/29244</a></li>
</ul>
https://ask.sagemath.org/question/51052/simplification-fails/?comment=51083#post-id-51083@Cyrille I have no error, maybe you forget to change the code from `var` to `SR.var`Mon, 27 Apr 2020 21:25:29 +0200https://ask.sagemath.org/question/51052/simplification-fails/?comment=51083#post-id-51083Comment by slelievre for <p>The first question is about simplyfing a symbolic expression.</p>
<p>The method <code>simplify_log</code> seems to do the trick.</p>
<pre><code>sage: x, a = SR.var('x a')
sage: Ra1 = -diff(x^a, x,2)/diff(x^a, x)
sage: Ra1
-(a - 1)*x^(a - 2)/x^(a - 1)
sage: Ra1.simplify_log()
-(a - 1)/x
</code></pre>
<p>I suppose the second question is about SageManifolds, but I'm not sure exactly what the question is.</p>
<p>Maybe this can help:</p>
<ul>
<li>Apply a function to all components of a tensor field
<a href="https://trac.sagemath.org/ticket/29244">https://trac.sagemath.org/ticket/29244</a></li>
</ul>
https://ask.sagemath.org/question/51052/simplification-fails/?comment=51084#post-id-51084@Masacroso -- No, var vs SR.var is not it, you can test that you would get the same either way.
@Cyrille -- what operating system, what version of Sage, how it was installed, whether is it based on Python 2 or Python 3.Mon, 27 Apr 2020 22:51:07 +0200https://ask.sagemath.org/question/51052/simplification-fails/?comment=51084#post-id-51084Comment by Cyrille for <p>The first question is about simplyfing a symbolic expression.</p>
<p>The method <code>simplify_log</code> seems to do the trick.</p>
<pre><code>sage: x, a = SR.var('x a')
sage: Ra1 = -diff(x^a, x,2)/diff(x^a, x)
sage: Ra1
-(a - 1)*x^(a - 2)/x^(a - 1)
sage: Ra1.simplify_log()
-(a - 1)/x
</code></pre>
<p>I suppose the second question is about SageManifolds, but I'm not sure exactly what the question is.</p>
<p>Maybe this can help:</p>
<ul>
<li>Apply a function to all components of a tensor field
<a href="https://trac.sagemath.org/ticket/29244">https://trac.sagemath.org/ticket/29244</a></li>
</ul>
https://ask.sagemath.org/question/51052/simplification-fails/?comment=51066#post-id-51066when I apply `simplify_log()` I have the following error
ECL says: Error executing code in Maxima:Mon, 27 Apr 2020 16:46:27 +0200https://ask.sagemath.org/question/51052/simplification-fails/?comment=51066#post-id-51066