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.Fri, 19 Jun 2015 18:29:27 +0200Taylor expansion assumptionshttps://ask.sagemath.org/question/27151/taylor-expansion-assumptions/ This is a very simply question, but I can't seem to get an appropriate answer in Sage. Let's say I have the following function:f(x,y,z)=sqrt(x^2+(y+1-z)^2). The taylor expansion around x=0 is sqrt((y+1-z)^2)+x^2/(2*sqrt((y+1-z)^2)) (analytic form, not the value Sage gives). Is it possible for Sage to take assumptions into account when expanding? For example, if I have assume(y>0,z>0,z>y+1), then clearly, (y+1-z)<0, so when simplifying, sqrt((y+1-z)^2)=z-y-1. However, Sage simply gives me the same answer regardless of assumption. Is there a way to fix this?Thu, 18 Jun 2015 20:43:17 +0200https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/Answer by tmonteil for <p>This is a very simply question, but I can't seem to get an appropriate answer in Sage. Let's say I have the following function:f(x,y,z)=sqrt(x^2+(y+1-z)^2). The taylor expansion around x=0 is sqrt((y+1-z)^2)+x^2/(2*sqrt((y+1-z)^2)) (analytic form, not the value Sage gives). Is it possible for Sage to take assumptions into account when expanding? For example, if I have assume(y>0,z>0,z>y+1), then clearly, (y+1-z)<0, so when simplifying, sqrt((y+1-z)^2)=z-y-1. However, Sage simply gives me the same answer regardless of assumption. Is there a way to fix this?</p>
https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/?answer=27153#post-id-27153On 6.8.beta4, i have the following behaviour, with no assumption:
sage: f(x, y, z) = sqrt(x^2 + (y+1-z)^2)
sage: f.taylor(x, 0, 3)
(x, y, z) |--> -1/2*x^2/(y - z + 1) - y + z - 1
This can be considered as a bug of too much simplifying.
Thu, 18 Jun 2015 22:49:34 +0200https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/?answer=27153#post-id-27153Comment by zalba for <p>On 6.8.beta4, i have the following behaviour, with no assumption:</p>
<pre><code>sage: f(x, y, z) = sqrt(x^2 + (y+1-z)^2)
sage: f.taylor(x, 0, 3)
(x, y, z) |--> -1/2*x^2/(y - z + 1) - y + z - 1
</code></pre>
<p>This can be considered as a bug of too much simplifying.</p>
https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/?comment=27155#post-id-27155I have the same thing; however, I was considering the case where z>y+1, so the solution given isn't correct in that case. The solution I gave was the general analytic form, not the one Sage gave.Thu, 18 Jun 2015 23:13:24 +0200https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/?comment=27155#post-id-27155Comment by tmonteil for <p>On 6.8.beta4, i have the following behaviour, with no assumption:</p>
<pre><code>sage: f(x, y, z) = sqrt(x^2 + (y+1-z)^2)
sage: f.taylor(x, 0, 3)
(x, y, z) |--> -1/2*x^2/(y - z + 1) - y + z - 1
</code></pre>
<p>This can be considered as a bug of too much simplifying.</p>
https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/?comment=27165#post-id-27165I see, i didn't understood your question.Fri, 19 Jun 2015 18:29:27 +0200https://ask.sagemath.org/question/27151/taylor-expansion-assumptions/?comment=27165#post-id-27165