c++ - parallel calculation of infinite series -


i have quick question, on how speed calculations of infinite series. 1 of examples: arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + ....

lets have library allow work big numbers, first obvious solution start adding/subtracting each element of sequence until reach target n.

you can pre-save x^n each next element instead of calculating x^(n+2) can lastx*(x^2)

but on seems sequential task, , can utilize multiple processors (8+)??.

thanks lot!

edit: need calculate 100k 1m iterations. c++ based application, looking abstract solution, shouldn't matter. reply.

you need break problem down match number of processors or threads have. in case have example 1 processor working on terms , working on odd terms. instead of precalculating x^2 , using lastx*(x^2), use lastx*(x^4) skip every other term. use 8 processors, multiply previous term x^16 skip 8 terms.

p.s. of time when presented problem this, it's worthwhile more efficient way of calculating result. better algorithms beat more horsepower of time.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -