Comparing two symbolic expressions without sympy

asked 2024-07-11 23:33:31 +0200

c.p. gravatar image

From

diff(sin(x),x) == cos(x)

one gets just trivial equality cos(x)== cos(x) instead of True. This can be fixed by loading sympy and

import sympy as sp
from sympy import *
x = symbols('x')

but this spoils my code. Is there a sage solution?

edit retag flag offensive close merge delete

Comments

2

I do not know if this helps in your case but you can check if the difference of the left hand side and the right hand side of the equation is zero. Or this:

bool(diff(sin(x),x) == cos(x))
tolga gravatar imagetolga ( 2024-07-12 06:18:40 +0200 )edit

It surely does, thanks.

c.p. gravatar imagec.p. ( 2024-07-12 08:00:05 +0200 )edit