Guest User

Untitled

a guest
Feb 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1.  
  2. function xDivFac (degree, number)
  3. tempResult=1
  4. for i=1,number, 1 do
  5. tempResult=tempResult*i
  6. end
  7.  
  8.  
  9. value=(math.pow(degree,number))/tempResult
  10. return value
  11. end
  12.  
  13. function taylorSinus (degree, precision)
  14. if precision == nil then
  15. precision= 13
  16. end
  17. sinus=0
  18. flipFlop=1
  19. precision=(precision*2)+1
  20. for i=1, precision, 2 do
  21.  
  22. if flipFlop>0 then
  23. sinus = sinus + xDivFac(degree, i)
  24. end
  25. if flipFlop <0 then
  26. sinus= sinus - (xDivFac(degree,i))
  27. end
  28.  
  29. flipFlop=flipFlop*-1
  30. end
  31. if sinus <0 then
  32. sinus=sinus*-1
  33. end
  34.  
  35. return sinus
  36. end
Add Comment
Please, Sign In to add comment