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, 17 Jul 2020 20:13:18 +0200$e^\left({\frac{-alog(x1)}{a+b}+\frac{alog(x1)}{a+b}+\frac{alog(x2)}{a+b}-\frac{alog(x3)}{a+b}}\right)$ does not simplify in sagehttps://ask.sagemath.org/question/52531/eleftfrac-alogx1abfracalogx1abfracalogx2ab-fracalogx3abright-does-not-simplify-in-sage/I'm running the following code in sage but the answer is not simplified all the way:
eq=e^(-a*log(x1)/(a+b)+a*log(x1)/(a+b)+a*log(x2)/(a+b)-a*log(x3)/(a+b))
eq
Out: [e^(a*log(x2)/(a + b) - a*log(x3)/(a + b))]
show(eq)
$$e^{\left(\frac{alog(x2)}{a + b} - \frac{alog(x3)}{a + b}\right)}$$
what I wanted to get is along the lines of
$$\left(\frac{x_2}{x_3}\right)^\frac{1}{a+b}$$
I've tried using `simplify_full()` with no success. any help is appreciated.EconJohnFri, 17 Jul 2020 20:13:18 +0200https://ask.sagemath.org/question/52531/How to simplify dirac_delta?https://ask.sagemath.org/question/51779/how-to-simplify-dirac_delta/Various manipulations are possible with `dirac_delta` and its derivatives. How can I teach sage to simplify these? For example, the following Green's function for a free particle in 1D could simplify to simply `dirac_delta(x)`:
sage: var('x,k')
sage: G = heaviside(x)*sin(k*x)/k
sage: simplify(k**2*G + diff(G, x, x))
2*cos(k*x)*dirac_delta(x) + sin(k*x)*diff(dirac_delta(x), x)/k
How can I teach sage to perform the following simplifications
f(x)*dirac_delta(x)
-> f(0)*dirac_delta(x)
f(x)*diff(dirac_delta(x),x)
-> diff(f(x), x)*dirac_delta(x)
-> diff(f(x), x).subs(x=0)*dirac_delta(x)
which would bring the answer into the desired form `dirac_delta(x)`?mforbesSat, 06 Jun 2020 08:16:37 +0200https://ask.sagemath.org/question/51779/How did simplify_full() manipulate this expression?https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/ This is sort of a follow up to a previous question of mine: https://ask.sagemath.org/question/47535/checking-identity-of-two-combinatorial-expressions/
I wanted to prove a certain combinatorial equality. Now, to prove this identity in Sage, I can define the two function $\text{LHS}(n,k)$ and $\text{RHS}(n,k)$ representing the left- and righthand side and make sure that $\text{LHS}(n,k)-\text{RHS}(n,k)=0$ with the following code (actually the code provides a proof of a slightly more general identity,
which holds for other values of $n, k$ as well.):
var('n k')
def LHS(n,k):
return n/2*(
(n/2+1-k)/(n/2+1)*((n/2+1)/(k/2)*binomial(n/2-3,k-4)*2**(n/2-k+1)*1/(k/2-1)*binomial(k-4,k/2-2))+
2*(k/2+1)/(n/2+1)*((n/2+1)/(k/2+1)*binomial(n/2-3,k-2)*2**(n/2-k-1)*1/(k/2)*binomial(k-2,k/2-1)))
def RHS(n,k):
return (n/k)*(2**(n/2-k))*binomial(n/2-2,k-2)*binomial(k-2,k/2-1)
(LHS(n,k)-RHS(n,k)).simplify_full()
This outputs
0
which is what I want but I would like to prove this identity with pen-and-paper and this seems to be a bit tricky. I wonder if there is a way to see how exactly simplify_full() were able simplify the expressions?joakim_uhlinFri, 30 Aug 2019 17:48:04 +0200https://ask.sagemath.org/question/47674/Sage doesn't simplify a fraction if it's multiplied by 2https://ask.sagemath.org/question/44544/sage-doesnt-simplify-a-fraction-if-its-multiplied-by-2/Hello, for some reason sage doesn't simplify a trigonometric expression:
sage: ( 2 * (1-cos(x)) / sqrt(1-cos(x)) ).simplify_full()
-2*(cos(x) - 1)/sqrt(-cos(x) + 1)
while I'd expect `sqrt(1-cos(x))`.
I also tried a nice `simplify_chain_real` function (thanks eric_g for [the hint](https://ask.sagemath.org/question/44414/canonicalize_radical-produces-incorrect-result/?answer=44421#post-id-44421)) but I've got the same result:
sage: from sage.manifolds.utilities import simplify_chain_real
sage: simplify_chain_real( 2 * (1-cos(x)) / sqrt(1-cos(x)) )
-2*(cos(x) - 1)/sqrt(-cos(x) + 1)
The weird thing is that it works without the `2*` part:
sage: ( (1-cos(x)) / sqrt(1-cos(x)) ).simplify_full()
sqrt(-cos(x) + 1)
And even replacing `-` with `+` makes it working:
sage: ( 2*(1+cos(x))/sqrt(1+cos(x)) ).simplify_full()
2*sqrt(cos(x) + 1)
I mean, obviously, it can do that kind of simplification. But I can't make it simplify the `2*(1-cos(x))/sqrt(1-cos(x))` expression. What do I miss?sagenoviceMon, 03 Dec 2018 04:22:20 +0100https://ask.sagemath.org/question/44544/.canonicalize_radical() produces incorrect resulthttps://ask.sagemath.org/question/44414/canonicalize_radical-produces-incorrect-result/I'm trying to simplify some trigonometric expressions using sage, and I noticed that .simplify_full() doesn't optimize those, unless a .canonicalize_radical() is used (thanks slelievre for [the hint](https://ask.sagemath.org/question/44391/simplify_full-doesnt-simplify-an-obvious-trigonometric-expression/?answer=44392#post-id-44392)). But that yields incorrect results for some expressions. For example:
sage: y = sqrt(sin(x)^2 + 4*sin(x) + 4) - sqrt(sin(x)^2 - 4*sin(x) + 4)
sage: y.simplify_full()
sqrt(sin(x)^2 + 4*sin(x) + 4) - sqrt(sin(x)^2 - 4*sin(x) + 4)
.canonicalize_radical() simplifies it further:
sage: y.canonicalize_radical()
4
But that is wrong! The answer should be `2*sin(x)`. Obviously it selected an incorrect sign for the second sqrt(...).
Is there a way to make .canonicalize_radical() smarter? Or any other way to simplify an expression like this correctly?sagenoviceSat, 24 Nov 2018 16:01:17 +0100https://ask.sagemath.org/question/44414/.simplify_full() doesn't simplify an obvious trigonometric expressionhttps://ask.sagemath.org/question/44391/simplify_full-doesnt-simplify-an-obvious-trigonometric-expression/Hello, I'm trying to simplify a trigonometric expression, and it didn't work as I expected. The original example was larger, but I reproduced the issue with a smaller one:
sage: y = (sin(x)+2) * sqrt( sin(x) / (sin(x)^2 + 4*sin(x) + 4) )
sage: y.simplify_full()
sqrt(sin(x)/(sin(x)^2 + 4*sin(x) + 4))*(sin(x) + 2)
Why doesn't that turn into `sqrt(sin(x))`? What do I miss?
sagenoviceFri, 23 Nov 2018 09:50:56 +0100https://ask.sagemath.org/question/44391/Simplify trig expressions with the double angle formulahttps://ask.sagemath.org/question/35213/simplify-trig-expressions-with-the-double-angle-formula/ I am trying to simplify the following expression in sage:
(sqrt(3)/3*cos(x)+1/3*sin(x))
the resulting expression should be:
2/3*cos(pi/6-x)
.simplify_full(), trig_reduce(), or simplify_trig() cannot produce this simplification.
Is sage currently capable of doing this?rtcFri, 21 Oct 2016 17:45:00 +0200https://ask.sagemath.org/question/35213/Simplifying rational expressionshttps://ask.sagemath.org/question/39111/simplifying-rational-expressions/I am working with a power series with coefficients being rational functions of several variables (everything over QQ). Is there any way to make sage automatically simplify the coefficients?
Here is an example of what is going on
k=RR.zero()+(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
print k
print u
print u-k
print (simplify(u))
print u
print parent(u)
print parent(k)
print factor(u.numerator())/factor(u.denominator())
And results:
(1/2*x^2 + x*y + 1/2*y^2 - 1/2*x*z - 1/2*y*z)/z^2
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
0
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field
Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field
(-1/2) * z^-2 * (-x - y + z) * (x + y)AntWed, 11 Oct 2017 06:20:26 +0200https://ask.sagemath.org/question/39111/Speed up simplify_full() on large expression via parallel?https://ask.sagemath.org/question/41586/speed-up-simplify_full-on-large-expression-via-parallel/ I have a rather long expression which was obtained from some calculations done by Sage. I am trying to apply different commands like simplify_full(), expand(), trig_reduce(), etc. on it but it is working very slowly. Is there a way to parallelize this operation? I think this should be possible because the operation is theoretically parallelizable. For example, if the expression has 10,000 terms, Sage might be able try to split it into 5 x 2000 term parts and run each one in 5 core (totally 5 cores from 8 cores on my CPU) and then in the end add up the simplified 5 parts and then try to simplify that again. I'm not sure if this is the proper way of doing it, so if there are easier ways, please tell me, I just want to manipulate my expression as quickly as possible. DanialBaghFri, 16 Mar 2018 16:45:18 +0100https://ask.sagemath.org/question/41586/simplifying ( x^beta )^( (mu - Lambda) / ( mu -2)) * x ^ ( alpha - beta + 4) is not satisfactoryhttps://ask.sagemath.org/question/35758/simplifying-xbeta-mu-lambda-mu-2-x-alpha-beta-4-is-not-satisfactory/The SageMath commands
var('x alpha beta Lambda mu')
f(x) = ( x^beta )^( (mu - Lambda) / ( mu -2)) * x ^ ( alpha - beta + 4)
f(x).simplify()
donot give the correct answer which I would expect that is g(x)
alpha_x = ((x*f.diff(x)/f).simplify_full()).factor()
g(x) = x^alpha_x
Does anyone know why ?
Here is what I would expect
x^(-(Lambda*beta - alpha*mu + 2*alpha - 2*beta - 4*mu + 8)/(mu - 2))
Here is what SageMath answers :
x^(alpha - beta + 4)/(x^beta)^((Lambda - mu)/(mu - 2))
It does not mix the exponants of x in the numerator with those of x in the denominator.
Thank you
PhilippeepimetheusSun, 27 Nov 2016 17:41:11 +0100https://ask.sagemath.org/question/35758/why won't simplify square roots?https://ask.sagemath.org/question/35711/why-wont-simplify-square-roots/sage: assume(x>2)
sage: sqrt(x^2 - 2*x + 1).simplify_full()
sqrt(x^2 - 2*x + 1)dannyThu, 24 Nov 2016 07:42:57 +0100https://ask.sagemath.org/question/35711/substitution not simplifyinghttps://ask.sagemath.org/question/35368/substitution-not-simplifying/I have the following code where everything works fine until `eq4` expression where all higher powers of `B` were simplified, unfortunately with `eq5` I can still see higher powers of `a` like `a^6` etc that were not simplified.
B,a,x,y = var('B a x y')
R=x^2+y^2;R
eq1=R.subs({x:((-12*a^3+92*a+24)*B-48*a^3-80*a+6)/(8*B-6)});eq1
eq2=eq1.subs({y:((11*a^3+65*a-52)*B-605*a^3+13*a-12)/(8*B+70)});eq2
eq3=eq2.simplify_full();eq3
eq4=eq3.subs({B: sqrt(-2)}).subs({sqrt(-2):B});eq4
eq5= eq4.subs({a^4: 5*a^2+32});eq5
which gives
1/4*(7291921*a^6 - 4678952*a^3 + 2*(3424035*a^6 + 1472328*a^3 + 24725813*a^2 + 1819560*a + 106127568)*B - 16*(19639*a^6 - 103688*a^3 + 1003105*a^2 - 163544*a + 8052784)*B - 70791609*a^2 + 10593256*a - 477643380)/(35072*B + 13999)
Is there a way I can fix this so that the only higher powers of `a` remaining aren't higher than `3` because of the `a^4` substitution.ShaThu, 03 Nov 2016 02:47:59 +0100https://ask.sagemath.org/question/35368/equation not simplifying and substituting properlyhttps://ask.sagemath.org/question/34854/equation-not-simplifying-and-substituting-properly/ I have the following code where I want to substitute t and p expression into my 'a' expression. Unfortunately what I get is a long equation which still have some powers of p and t variable in it. It seems like the substitution did not work properly
a,t,p,l,k,c,b=var('a t p l c k b')
a=(-2*p*t^2-p^2*t)+(2*t*p-p^2)+t+1;a
A=a.subs({t:((c-a)+4*l)/(a+b+c)}).subs({p:((b-c)+4*k)/(a+b+c)});A
This is what I obtained :
-(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - k - 4*l - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)/(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) + b + k - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1) + 2*(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - k - 4*l - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)*(b + 4*c - k)/((p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)*(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) + b + k - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)) + 2*(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - k - 4*l - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)^2*(b + 4*c - k)/((p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)*(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) + b + k - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)^2) - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + (2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - k - 4*l - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)*(b + 4*c - k)^2/((p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2*(2*(b + 4*c - k)*t^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) + b + k - 2*(b + 4*c - k)*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1) - (b + 4*c - k)^2*t/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + t - (b + 4*c - k)^2/(p^2*t + 2*p*t^2 + p^2 - 2*p*t - b - k - t - 1)^2 + 1)) + 1
And I also have `l^2=2c^2+2a^2-b^2` and `k^2=2b^2+2c^2-a^2`. Is there a way I can make all this substitution at once. The final answer should simplify down to 'a'.ShaMon, 19 Sep 2016 09:33:01 +0200https://ask.sagemath.org/question/34854/(abs(sin(x))^2).simplify_full()https://ask.sagemath.org/question/9740/abssinx2simplify_full/I think (abs(sin(x))^2).simplify_full() should render sin(x)^2. This is not the case in sage 5.6 even with the assumption assume(x, 'real'). Is this a [known] bug?
jllbTue, 29 Jan 2013 10:07:09 +0100https://ask.sagemath.org/question/9740/Simplify expressionshttps://ask.sagemath.org/question/25180/simplify-expressions/Hi, I've got this long equation:
F_zr == (F_xc*p_fcx*p_rcy*p_rcz + c_N_x*p_fcx*p_rcx - c_N_y*p_fcx*p_rcy+ (p_fcx*p_rcx - p_rcx^2)*F_yc*p_rcz + c_N_z*p_rcx*p_rcz - (F_xc*p_rcx*p_rcy*p_rcz + c_N_x*p_rcx^2 - c_N_y*p_rcx*p_rcy +c_N_z*p_rcx*p_rcz)*cos(delta(t)) - (F_yc*p_rcx*p_rcy*p_rcz -c_N_z*p_rcy*p_rcz)*sin(delta(t)))/((p_fcx*p_rcx -p_rcx^2)*p_rcy*cos(delta(t)) - (p_fcx^2 - p_fcx*p_rcx)*p_rcy)
I tried doing simplify_full() but the output is not simple at all.
I read about using ._mathematica_().FullSimplify() but it says permission denied.
How can I really simplify it?
Thank you.
SilviaTue, 09 Dec 2014 17:45:56 +0100https://ask.sagemath.org/question/25180/simplify_full - is the mistake in the documentation or the source code?https://ask.sagemath.org/question/10939/simplify_full-is-the-mistake-in-the-documentation-or-the-source-code/Looking at the simplify_full documentation in Sage 6.0, it says that it
> Applies simplify_factorial,
> simplify_trig, simplify_rational,
> simplify_radical, simplify_log, and
> again simplify_rational to self (in
> that order).
However the source code is
def simplify_full(self):
x = self
x = x.simplify_factorial()
x = x.simplify_trig()
x = x.simplify_rational()
x = x.simplify_log('one')
x = x.simplify_rational()
return x
So where is the mistake? Should simplify_radical be added to the source code or removed from the documentation?brkirchFri, 17 Jan 2014 16:38:00 +0100https://ask.sagemath.org/question/10939/simplification errors in simple expressionshttps://ask.sagemath.org/question/8324/simplification-errors-in-simple-expressions/I'm currently testing the possibilities of SAGE as a teaching aid in a high school math course (in Belgium). I stumbled upon this:
- When evaluating x/sqrt(x^2), SAGE answers $\frac{x}{|x|}$, as it should. Appending a ***.simpify()***-instruction to the input does not change anything.
- However, `((1-x^2)/sqrt(1-2*x^2+x^4)).simplify_full()` evaluates to $-1$, in stead of $\frac{1-x^2}{|1-x^2|}$.
As an aside, it's definitely baffling that a behemoth program like SAGE is outdone in this respect by a one-floppy-disk, antique program called DERIVE.
As another aside, I still have to find a meaningful use for the instruction ***simplify()***. Can someone provide me an expression that is actually simplified by simplify()?
***Note added:***
I'm not sure I'm satisfied with mr. Fateman's answer (and I definitely disagree that defining sqrt(x^2)=|x| - for real x - entails +1=-1). But what I really want to know is this: is there a SAGE object that represents (reliably) the positive square root of a positive real number x? (Surely a quantity that is not without interest.) And how do I define it in SAGE?Dirk DanckaertThu, 22 Sep 2011 17:53:33 +0200https://ask.sagemath.org/question/8324/simplify sinh expressionhttps://ask.sagemath.org/question/9723/simplify-sinh-expression/I guess I just ran up against one of those maxima things again, but I thought I would signal the problem anyway.
I would have expected Sage to simplify
sinh(log(1+sqrt(2)))
(it is 1), but Sage doesn't. It doesn't return True to the following either
arcsinh(1)==1+sqrt(2)
or am I missing something?Dirk DanckaertSun, 20 Jan 2013 11:13:50 +0100https://ask.sagemath.org/question/9723/Why simplify doesn't work?https://ask.sagemath.org/question/9558/why-simplify-doesnt-work/Hi! My problem is that I don't want to use simplify_full(). It messes up the way my formulea look preety bad. Yet I have in them terms of the form:
f(x,y)=(x^y)^(1/y)
and these a left untouched by simplify(). Is there any way for sage to recognize, that f=x without simplify_full()?
.
(Here's what i mean by messed up formula:
var('x,b2,b1')
f1(x,b1,b2)= e^(-x/b2)/b2 - e^(-x/b1)/b1
f2(x,b1,b2)= x
f1=f1( x=log( (b1/b2)^(b1*b2/(b1-b2)) ) )
f2=f2( x=log( (b1/b2)^(b1*b2/(b1-b2)) ) )
show( f1.simplify_full() + f2.simplify_full()== (f1+f2).simplify_full() )
The lhs looks way better, doesn't it?)
.
Big thanks in advance for any comments!ozikThu, 22 Nov 2012 20:17:49 +0100https://ask.sagemath.org/question/9558/simplify trig, abs, and sqrt expressionhttps://ask.sagemath.org/question/9031/simplify-trig-abs-and-sqrt-expression/I'm computing the Frenet frame for a helix. Sage does not seem to want to simplify expressions like $\sqrt{|r^2 \sin(\theta)|^2+|r^2 \cos(\theta)^2|}$ without using `simplify_full` followed by `simplify_trig`. My code is below. What I've done is not elegant. Can anyone suggest a cleaner approach?
var('r,theta,x,y,t,R')
assume(r>0)
assume(R>0)
assume(t,'real')
f(t) = (R*cos(t),R*sin(t),t)
tangent=diff(f(t),t)
normal=diff(tangent,t)
binormal=tangent.cross_product(normal)
norm_of_tangent=tangent.norm().simplify_full().simplify_trig()
norm_of_normal=normal.norm().simplify_full().simplify_trig()
norm_of_binormal=binormal.norm().simplify_full().simplify_trig()
F=matrix([tangent/norm_of_tangent,normal/norm_of_normal,binormal/norm_of_binormal]).transpose()
F
The result is:
[-R*sin(t)/sqrt(R^2 + 1), -cos(t), sin(t)/sqrt(R^2 + 1)]
[R*cos(t)/sqrt(R^2 + 1), -sin(t), -cos(t)/sqrt(R^2 + 1)]
[1/sqrt(R^2 + 1), 0, (R^2*sin(t)^2 + R^2*cos(t)^2)/(sqrt(R^2 + 1)*R)]
calc314Tue, 05 Jun 2012 13:32:00 +0200https://ask.sagemath.org/question/9031/simplify_full developmenthttps://ask.sagemath.org/question/8684/simplify_full-development/Hi! Could someone elaborate on the status of the simplification routines in SAGE? I've noticed that the simplify_full can't exactly be said to compete with e.g. mathematica's corresponding FullSimplify...
I don't know if the simplify functions operate as replacement rules or such, but if they do, I might be able to contribute in the development (I'm not much of a programmer though).
So could someone please explain about how simplify_full and other simplification functions work, and how I and others can participate? This post could work as an info for all who want to take part!H. ArponenTue, 31 Jan 2012 11:03:17 +0100https://ask.sagemath.org/question/8684/Taking derivative of a solutionhttps://ask.sagemath.org/question/8490/taking-derivative-of-a-solution/Hi, is there a way to take a derivative of a solution of equations?
For example,
var('p, alpha, beta, q, A, B, J, K')
h=solve([p==alpha+2*beta*q, A-B*p==J*q, p*q-K-alpha*q-beta*q^2==0],p,q,J)
in the solution expressions for `p,q,J`, can I take a partial derivative of each with respect to `A` by adding some kind of an expression? Also, is there a effective way to simplify the results that I get for `p,q,J`?HunFri, 18 Nov 2011 08:58:41 +0100https://ask.sagemath.org/question/8490/simplify_full() and symbolic vectorshttps://ask.sagemath.org/question/8338/simplify_full-and-symbolic-vectors/<b>First, the question:</b>
Suppose I've constructed some vectors with symbolic entries, call them P0 and P1. Calling simplify_full on them will -- apparently by changes introduced in the latest version (#11335 and #11381)! -- do an elementwise simplification. Great!
Suppose I construct a new symbolic vector by, say, interpolating between P0 and P1:
Pt = (1-t)*P0 + t*P1
Now
Pt.simplify_full()
produces
Traceback (click to the left of this block for traceback)
...
AttributeError:
'sage.modules.free_module_element.FreeModuleElement_generic_dense'
object has no attribute 'simplify_full'
whereas
P0.simplify_full()
and
P1.simplify_full()
work just fine. Somehow the symbolic vector-ness is forgotten in the construction of Pt.<p/>Am I doing something wrong?
<p/>
<b>Then, the disclaimer:</b>
A friend pointed me to Sage today, and this is the first thing I'm trying to do with it -- I do have background in some other symbolic tools, but this may just be a Stupid User Error despite giving this my best shot and looking at documentation.
<p/>
Anyway, I'm very impressed with what I'm seeing when I look at Sage.
<p/>
(For completeness' sake, here's a full example:
var('x,w,C0,C1,t')
P0=vector([0, C1*w/(C1*w+C0) - w/(w+C0/C1)])
P1=vector([cos(x)/sin(x)*tan(x)-1, 0])
Now both
P0.simplify_full()
P1.simplify_full()
return (0,0) as they should. But
Pt=(1-t)*P0+t*P1
Pt.simplify_full()
returns the above error.)__jacques__Tue, 20 Sep 2011 17:37:30 +0200https://ask.sagemath.org/question/8338/Is there a way to simplify_full and trig_reduce a matrix?https://ask.sagemath.org/question/7773/is-there-a-way-to-simplify_full-and-trig_reduce-a-matrix/I know I can do it component by component and then construct a matrix out of the output. But it would be nice if I could just say matrix.trig_reduce() and get a matrix with all the components trig_reduced.
Thanks in advance
ShashankThu, 25 Nov 2010 17:54:20 +0100https://ask.sagemath.org/question/7773/simplify() does not work?https://ask.sagemath.org/question/8101/simplify-does-not-work/I enter:
sage: a, b = var('a, b'); simplify((a + b)^2 - a^2 - 2*a*b - b^2)
and I would expect 0 (i.e. zero) as a result from simplify(),
but instead I get back unmodified:
(a + b)^2 - a^2 - 2*a*b - b^2
Am I missing anything?
I just started using it and it looks very promissing...ryszard314159Wed, 04 May 2011 10:35:34 +0200https://ask.sagemath.org/question/8101/simply_full for expressions with exponentshttps://ask.sagemath.org/question/8083/simply_full-for-expressions-with-exponents/Hello,
I am new to sage and I am trying to simplify some expression.
If I try:
var('a');
h = 2^(a - 2) * 3^(a + 3) / 6^a;
h.simplify_full();
I get 27 / 4 which is right. However if I try
var('a');
h = (2^(a - 2) * 3^(a + 3) / 6^a == 27 / 4);
h.simplify_full();
I get (27/4) == (27/4). I don't understand why I do not get
the answer True in this case.
viorel preoteasaTue, 19 Apr 2011 09:06:09 +0200https://ask.sagemath.org/question/8083/Simplify, Solve Equation and use solutionhttps://ask.sagemath.org/question/7908/simplify-solve-equation-and-use-solution/Hi, I'm new to sage, and have the following question:
I have the following code:
> x,y=var('x y')
>
> f(x,y)= sin(x)*cos(y)+sin(y)*cos(x)
> f.full_simplify
> show(f(x,y))
>
>
>
> s1=solve([f(x,y)==1],x,y)
> show(s1)
Sage obiously doesn't simplify the function f... (simple trigonometric expression). And it doesn't solve it.
**1**) How can I simplify the function?
**2)** How can I use the result? For example: I have as an result:
solution=[x == -1]
How can I replace this x in an other function (example: sin(x)).
In mathematica I would do: sin(x) /. solution
or manually: sin(x) /. x->(-1)manifoldFri, 28 Jan 2011 10:07:13 +0100https://ask.sagemath.org/question/7908/