lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On Apr 4, 2019, at 5:25 PM, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
> 
> The most straightforward approach is 
> to build Taylor series of cin(x) one term at a time.  
>          
>    function maclaurin_of_cin(k) 
>       for n = #c + 1, k do 
>          a = {} 
>          local e, h = f(c), f(d) 
>          s, a = -s/(2*n)/(2*n+1) 
>          local t = (s-h-e)/3 
>          assert(math.abs(t) < 0.056) 
>          c[n], d[n] = t, e + 2*t 
>       end 
>       return c[k] 
>    end 

Say, I wanted a function, din(x), such that din(din(din(din(x)))) = sin(x)

What is required to modify above to do maclaurin_of_din(k) ?