On Wednesday, June 17, 2015 at 9:04:54 PM UTC+2, Shivam Vats wrote:
>
>
>
> Is your question related to series somehow? What kind of compositions 
>> do you have in mind? 
>
> Yes, Ondrej. Since, we have already implemented many elementary
> functions in ring_series, it will be nice if we have faster methods
> to invert them and their compositions (eg sin(sin(x)))
>
> The general idea is that computing logarithmic and inverse trigonometric 
>> functions of formal power series is just algebraic operations on power 
>> series followed by formal (term by term) integration, e.g. log(f(x)) = int 
>> f'(x) / f(x) dx. From there, Newton iteration allows you to compute 
>> exponential and forward trigonometric functions.
>
> Right! We have attempted something similar in `ring_series`.
> Formula based expansion as `_atan_series` and this method 
> as `rs_atan` are implemented here 
> <https://github.com/sympy/sympy/blob/master/sympy/polys/ring_series.py#L627>. 
> `_atan_series` seems to 
> be much faster than `rs_atan`. As of now, we expand `tan` 
> from `atan` using Newton iterations and sin/cos from `tan` 
> using half angle formula. What do you suggest?
>

Yes, for atan this is the right approach.

For sin/cos, exp, tan, etc. Newton iteration is optimal for long power 
series if you have asymptotically fast polynomial multiplication. When your 
multiplication is O(n^2), the following O(mn) algorithm for exponentials 
(where m is the length of the input and n is the length of the output) is 
better:

    def exp_series(A, n):
        B = [exp(A[0])]
        for k in range(1, n):
            B.append(sum(j*A[j]*B[k-j]/k for j in range(1,min(len(A),k+1))))
        return B

It's easy to turn this into an algorithm for sin/cos (and hence also tan), 
and there is an analog for raising a series to a constant power (if I 
remember correctly, it's in Knuth vol 2).

Fredrik

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/fb6a669b-8071-4f63-93d3-05245870151a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to