Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function xDivFac (degree, number)
- tempResult=1
- for i=1,number, 1 do
- tempResult=tempResult*i
- end
- value=(math.pow(degree,number))/tempResult
- return value
- end
- function taylorSinus (degree, precision)
- if precision == nil then
- precision= 13
- end
- sinus=0
- flipFlop=1
- precision=(precision*2)+1
- for i=1, precision, 2 do
- if flipFlop>0 then
- sinus = sinus + xDivFac(degree, i)
- end
- if flipFlop <0 then
- sinus= sinus - (xDivFac(degree,i))
- end
- flipFlop=flipFlop*-1
- end
- if sinus <0 then
- sinus=sinus*-1
- end
- return sinus
- end
Add Comment
Please, Sign In to add comment