On Sun, Aug 24, 2008 at 8:12 PM, William Stein <[EMAIL PROTECTED]> wrote:
>
> On Sun, Aug 24, 2008 at 11:03 AM, Ryan <[EMAIL PROTECTED]> wrote:
>>
>> Thanks, both seem like workable options. A related question...
>>
>> There are alot of different simplify commands, but not one that seems
>> to be effective for hyperbolic trig functions. For instance
>>
>> cosh(arcsinh(3/2)) simplifies to sqrt(13)/2
>>
>> but none of the simplify commands seem to produce this.
>>
>> Any thoughts?
>>
>
> Wait a little? In the new Ginac-based Sage symbolic
> code that Burcin and I are implementing right now this works
> automatically:
>
> sage: x = var('x', ns=1); S = x.parent()
> sage: S(3/2).arcsinh().cosh()
> sqrt(13/4)
>
> Keep your eye on
> http://trac.sagemath.org/sage_trac/ticket/3872
>
> Ginac is a very robust fast C++ library for symbolic manipulation
> that will replace most of Sage's current dependence on Maxima
> by something much better. http://www.ginac.de/
>
> Sympy doesn't automatically do the above simplification (yet):
>
> sage: import sympy
> sage: Integer = sympy.Integer
> sage: sympy.cosh(sympy.asinh(3/2))
> cosh(asinh(3/2))
>
>
> By the way, in ginac the C++ code that defines the above simplification
> is here:
>
>
> if (is_exactly_a<function>(x)) {
> const ex &t = x.op(0);
>
> // cosh(acosh(x)) -> x
> if (is_ex_the_function(x, acosh))
> return t;
>
> // cosh(asinh(x)) -> sqrt(1+x^2)
> if (is_ex_the_function(x, asinh))
> return sqrt(_ex1+power(t,_ex2));
>
> // cosh(atanh(x)) -> 1/sqrt(1-x^2)
> if (is_ex_the_function(x, atanh))
> return power(_ex1-power(t,_ex2),_ex_1_2);
> }
>
> It's in the file inifcns_trans.cpp in the ginac distribution.
I sent a patch fixing this to:
http://code.google.com/p/sympy/issues/detail?id=1037
This is what I did in sympy:
+ if isinstance(arg, acosh):
+ return arg.args[0]
+
+ if isinstance(arg, asinh):
+ return sqrt(1+arg.args[0]**2)
+
+ if isinstance(arg, atanh):
+ return 1/sqrt(1-arg.args[0]**2)
Ondrej
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---