someone wrote:
>
> Latest Fricas can do the Shi and Chi integrals without
> calling the pattern matcher:
>
>
> (4) -> integrate(sinh(x)/x, x)
>
> Ei(x) - Ei(- x)
> (4) ---------------
> 2
> Type: Union(Expression(Integer),...)
> (5) -> integrate(cosh(x)/x, x)
>
> Ei(x) + Ei(- x)
> (5) ---------------
> 2
> Type: Union(Expression(Integer),...)
>
> That is nice to see :-)
>
> Where do we need to add code such that Fricas can transform
> these results into Shi and Chi respectively?
Look at src/algebra/integrat.spad.pamphlet. Currently hyperbolic
functions are generated in the 'rinteg' routine. The tactic
is very simple: if there is any hyperbolic function in
the input, then all exponentials are converted to hyperbolics:
(15) -> integrate(sinh(x) + x*exp(x^2), x)
(15)
2 2 2 2 2 2 2
(sinh(x) - cosh(x) )sinh(x ) + cosh(x )sinh(x) - cosh(x) cosh(x )
+
- 2cosh(x)
/
2 2
2sinh(x) - 2cosh(x)
Type: Union(Expression(Integer),...)
In principle one can convert Ei to Si/Ci in the same place. To
say the truth, it would be good to make code a bit smarter and
only convert exponentials and Ei-s that came from hyperbolics.
> Even better to see how the new code handles more complicated
> integrands like the following one:
>
> (23) -> integrate(cosh(a*x^2+c)/x, x)
>
> 2 2 2 2
> (Ei(a x ) - Ei(- a x ))sinh(c) + (Ei(a x ) + Ei(- a x ))cosh(c)
> (23) ---------------------------------------------------------------
> 4
> Type: Union(Expression(Integer),...)
> (24) -> normalize(%)
>
> 2 c 2 2
> Ei(a x )(%e ) + Ei(- a x )
> (24) ---------------------------
> c
> 4%e
> Type: Expression(Integer)
> (25) -> D(%, x)
>
> 2 2
> c 2 a x - a x
> (%e ) %e + %e
> (25) -----------------------
> c
> 2x %e
> Type: Expression(Integer)
> (26) -> normalize(%)
>
> 2 2
> c 2 a x
> (%e ) (%e ) + 1
> (26) -------------------
> 2
> c a x
> 2x %e %e
> Type: Expression(Integer)
> (27) -> normalize(cosh(a*x^2+c)/x)
>
> 2 2
> a x + c
> (%e ) + 1
> (27) -----------------
> 2
> a x + c
> 2x %e
> Type: Expression(Integer)
>
> I don't know why they do not normalize to the same form
> but it's obvious the result is correct.
'normalize' sees no reason to pull 'c' out from the exponential.
OTOH integrator has to introduce 'exp(c)' and normalize is
content with 'exp(x)' and 'exp(a*x^2)' as separate
exponentials. To check that to expressions are equal
normalize their difference:
(16) -> normalize(exp(c)*exp(a*x^2))
2
c a x
(16) %e %e
Type: Expression(Integer)
(17) -> normalize(exp(a*x^2 + c))
2
a x + c
(17) %e
Type: Expression(Integer)
(18) -> normalize(exp(c)*exp(a*x^2) - exp(a*x^2 + c))
(18) 0
Type: Expression(Integer)
>
> The other two are not possible at the moment and still use pattern matching.
>
> (1) -> integrate(sin(x)/x, x)
>
> (1) Si(x)
>
As I wrote: complicate it enough and new code will kick in.
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.