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.Thu, 30 Sep 2021 05:52:02 +0200Is it possible to ask sage check symbolic equality by comparing parts within equations?https://ask.sagemath.org/question/59194/is-it-possible-to-ask-sage-check-symbolic-equality-by-comparing-parts-within-equations/ So I have a case with two complicated equations, when substitutes with certain parameters, those two functions equal each other. I know that sage is capable on comparing simple equations like `2*x+4==2*x+4 and print(True)` could print `True` properly, but when functions grow more complicate, it couldn't.
But when I call `show()` on my functions that sage return to me after symbolic substitution, they're identical, like everything. Which makes me wonder since everything are exactly the same, why sage couldn't properly evaluate equality? And is there any way I could hack around it? Perhaps like breaking them into small parts and ensure each parts are identical?andrewygThu, 30 Sep 2021 05:52:02 +0200https://ask.sagemath.org/question/59194/looping of equality functionhttps://ask.sagemath.org/question/49898/looping-of-equality-function/ Hi, I have the equation `x^4+y^4=z^3`. I want to run each variable from `-100` till `100` to see which numbers satisfy this equation. Here is what I have done:
x,y,z= var('x y z')
for x in range(-100, 100):
for y in range(-100, 100):
for z in range(-100, 100):
x^4+y^4==z^3
print(x,y,z)
There is definitely something wrong with the coding that's not giving me the desired answer. Can someone enlighten me, please.
ShaThu, 13 Feb 2020 04:52:34 +0100https://ask.sagemath.org/question/49898/Equality test of symbolic expressionshttps://ask.sagemath.org/question/41757/equality-test-of-symbolic-expressions/I'm confused about the equality test of symbolic expressions. I saw the recently asked question https://ask.sagemath.org/question/41735/how-to-get-a-truefalse-for-complex-numbers/ and, coincidently, I read something similar on the first page of the second chapter of this book http://dl.lateralis.org/public/sagebook/sagebook-web-20130530.pdf. It says that Sage evaluates the following expressions as below,
sage: bool(arctan(1+abs(x)) == pi/2 - arctan(1/(1+abs(x))))
False
sage: bool(arctan(sqrt(2)) == pi/2 - arctan(1/sqrt(2)))
True
In Wikipedia (https://en.wikipedia.org/wiki/List_of_trigonometric_identities), we can verify the corresponding trigonometric identity.
$ arctan\left(x\right) + arctan\left(\frac{1}{x}\right) = \frac{\pi}{2}, \; if \; x>0$
and
$ arctan\left(x\right) + arctan\left(\frac{1}{x}\right) = -\frac{\pi}{2}, \; if \; x<0$
The above evaluation works as is in the version I am using.
sage: version()
'SageMath version 7.5.1, Release Date: 2017-01-15'
However, in Sage Math Cell or Cocalc ('SageMath version 8.1, Release Date: 2017-12-07') both tests evaluate to False.
Mathematica is not able to evaluate any of the expressions and return the entire equality test without evaluation.
Questions:
1) I understand that both tests should evaluate to True, am I right? If so, and as Sage 7.5.1 can verify the second equality, why it can't verify the first?
2) Why the newer version of Sage cannot verify the second equation anymore?
3) Differently from Mathematica, that returns True if both expressions are numerically equal, False otherwise and returns the test unevaluated if it cannot establish the equality, Sage returns True if it can prove that the difference between both expressions is zero and False otherwise. Is this correct?joaoffSun, 25 Mar 2018 21:44:56 +0200https://ask.sagemath.org/question/41757/Why is a==b False?https://ask.sagemath.org/question/40024/why-is-ab-false/Please see the following code. Why is a==b False? Thanks!
Input:
a=n(1/2*sqrt(5) - 1/2,digits=15)
b=n(1-a^2,digits=15)
print a
print b
a==b
Output:
0.618033988749895
0.618033988749895
FalseKapcakSat, 09 Dec 2017 00:45:51 +0100https://ask.sagemath.org/question/40024/Why does assume() mess with equality checks?https://ask.sagemath.org/question/38562/why-does-assume-mess-with-equality-checks/I ran into this interesting behaviour just now:
sage: bool(10 == log(282475249)/log(7))
True
sage: assume(282475249 == 7^x)
sage: bool(10 == log(282475249)/log(7))
False
Is this a bug? `assume(7^x == 282475249)` doesn't trigger the weird behaviour, but I'd expect those two assumptions to be equivalent.
I'm running `SageMath version 8.0, Release Date: 2017-07-21`tavianatorThu, 17 Aug 2017 23:05:29 +0200https://ask.sagemath.org/question/38562/How I can test this equality with sage?https://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/How I can test this equality?
$$\sum_{n=0}^\infty\frac{(-1)^{n+1}}{3 n+6 (-1)^n}=\frac{\log(2)-1}{3}$$
Im interested in symbolic tests and numerical tests. My knowledge about the way to do this with sage (in general in any CAS, not only sage) is near to zero. Any help, link, etc. will be appreciated, thank you.
---------------------------
**EDIT:** I tried to use this code (what is a slight simplification of the above equality)
var("n")
sum(1/(n*(-1)^n+2),n,0,oo) == -log(2)+1
but, as expected, it dont work.MasacrosoSun, 30 Oct 2016 19:26:31 +0100https://ask.sagemath.org/question/35305/