Request for advice : extend exponentialize ?

35 views
Skip to first unread message

Emmanuel Charpentier

unread,
Jul 2, 2022, 4:32:30 AM7/2/22
to sage-devel

The SR.exponentialize method implements :

sage: [u(x)==u(x)._sympy_().rewrite("exp")._sage_()
....:  for u in (sin, cos, tan, csc, sec, cot, sinh, cosh, tanh, csch, sech, coth)]
[sin(x) == -1/2*I*e^(I*x) + 1/2*I*e^(-I*x),
 cos(x) == 1/2*e^(I*x) + 1/2*e^(-I*x),
 tan(x) == -I*(e^(I*x) - e^(-I*x))/(e^(I*x) + e^(-I*x)),
 csc(x) == 2*I/(e^(I*x) - e^(-I*x)),
 sec(x) == 2/(e^(I*x) + e^(-I*x)),
 cot(x) == I*(e^(I*x) + e^(-I*x))/(e^(I*x) - e^(-I*x)),
 sinh(x) == -1/2*e^(-x) + 1/2*e^x,
 cosh(x) == 1/2*e^(-x) + 1/2*e^x,
 tanh(x) == -(e^(-x) - e^x)/(e^(-x) + e^x),
 csch(x) == -2/(e^(-x) - e^x),
 sech(x) == 2/(e^(-x) + e^x),
 coth(x) == -(e^(-x) + e^x)/(e^(-x) - e^x)]

However, we also have :

sage: [u(x)==u(x)._sympy_().rewrite("log")._sage_()
....:  for u in (arcsin, arccos, arctan, arccsc, arcsec, arccot, arcsinh, arccosh, arctanh, arccsch, arcsech, arccoth)]
[arcsin(x) == -I*log(I*x + sqrt(-x^2 + 1)),
 arccos(x) == 1/2*pi + I*log(I*x + sqrt(-x^2 + 1)),
 arctan(x) == -1/2*I*log(I*x + 1) + 1/2*I*log(-I*x + 1),
 arccsc(x) == -I*log(sqrt(-1/x^2 + 1) + I/x),
 arcsec(x) == 1/2*pi + I*log(sqrt(-1/x^2 + 1) + I/x),
 arccot(x) == -1/2*I*log(I/x + 1) + 1/2*I*log(-I/x + 1),
 arcsinh(x) == log(x + sqrt(x^2 + 1)),
 arccosh(x) == log(sqrt(x + 1)*sqrt(x - 1) + x),
 arctanh(x) == 1/2*log(x + 1) - 1/2*log(-x + 1),
 arccsch(x) == log(sqrt(1/x^2 + 1) + 1/x),
 arcsech(x) == log(sqrt(1/x + 1)*sqrt(1/x - 1) + 1/x),
 arccoth(x) == 1/2*log(1/x + 1) - 1/2*log(-1/x + 1)]

Hence two questions :

  • Is it worth implementing it (for the benefit of high-school/undergrads/engineering math) ?

  • Should it be implemented by SR.exponentialize or by a distinct method ? (My preference is for the former, notwithstanding the apparent discrepancy in names…).

Your advice is welcome.

Emmanuel Charpentier

unread,
Jul 2, 2022, 4:50:18 AM7/2/22
to sage-devel

BTW, (too ?) simple check :

sage: all(map(lambda u,v:bool(u(v(x)._sympy_().rewrite("log")._sage_()).exponentialize().simplify_full()==x),
....:         (sin, cos, tan, csc, sec, cot, sinh, cosh, tanh, csch, sech, coth),
....:         (arcsin, arccos, arctan, arccsc, arcsec, arccot, arcsinh, arccosh, arctanh, arccsch, arcsech, arccoth)))
True
Message has been deleted

Emmanuel Charpentier

unread,
Jul 3, 2022, 12:11:44 PM7/3/22
to sage-devel

Never mind : I went ahead and created Trac#34108, which needs_review (hint, hint….).

HTH,

Le samedi 2 juillet 2022 à 10:32:30 UTC+2, Emmanuel Charpentier a écrit :
Reply all
Reply to author
Forward
0 new messages