Bolodefchoco_LUAXML

[Math] Xatan & Satan

May 19th, 2016
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 19/05/2016
  3. --Last update: 26/05/2016
  4. --[[ Notes:
  5.     Does:
  6.         As funções-raiz de muitas funções da biblioteca oficial de math
  7.         xatan
  8.             Does:
  9.                  Avalia uma série válida no intervalo [0,0.66].
  10.             Args:
  11.                 x --> Número
  12.         satan
  13.             Does:
  14.                 Reduz seus argumentos (conhecido por ser positivo). Requer xatan
  15.             Args:
  16.                 x --> Número
  17. ]]--
  18.  
  19. xatan=function(x)
  20.     local P = {
  21.         -8.750608600031904122785e-01,
  22.         -1.615753718733365076637e+01,
  23.         -7.500855792314704667340e+01,
  24.         -1.228866684490136173410e+02,
  25.         -6.485021904942025371773e+01,
  26.     }
  27.     local Q = {
  28.         2.485846490142306297962e+01,
  29.         1.650270098316988542046e+02,
  30.         4.328810604912902668951e+02,
  31.         4.853903996359136964868e+02,
  32.         1.945506571482613964425e+02,
  33.     }
  34.     local z = x^2
  35.     z = z * ((((P[1]*z+P[2])*z+P[3])*z+P[4])*z + P[5])/(((((z+Q[1])*z+Q[2])*z+Q[3])*z+Q[4])*z + Q[5])
  36.     z = x*z + x
  37.     return z
  38. end
  39.  
  40. satan=function(x)
  41.     if x <= .66 then
  42.         return xatan(x)
  43.     end
  44.     if x > 2.41421356237309504880 then
  45.         return math.pi/2-xatan(1/x)
  46.     end
  47.     return math.pi/4+xatan((x-1)/(x+1)) + .5*6.123233995736765886130e-17
  48. end
Advertisement
Add Comment
Please, Sign In to add comment