Category talk:Wren-math: Difference between revisions
Content added Content deleted
(→Source code: Removed a constant which is now in the core library.) |
(Bug fixes, restoration of static Math.min/max methods and addition of Math.atan.) |
||
Line 14: | Line 14: | ||
// Hyperbolic trig functions. |
// Hyperbolic trig functions. |
||
static sinh(x) { (exp |
static sinh(x) { (x.exp - (-x).exp)/2 } // sine |
||
static cosh(x) { (exp |
static cosh(x) { (x.exp + (-x).exp)/2 } // cosine |
||
static tanh(x) { sinh(x)/cosh(x) } // tangent |
static tanh(x) { sinh(x)/cosh(x) } // tangent |
||
Line 82: | Line 82: | ||
var sum = p[0] |
var sum = p[0] |
||
for (i in 0..7) sum = sum + p[i+1]/(x + i) |
for (i in 0..7) sum = sum + p[i+1]/(x + i) |
||
return 2.sqrt * Num.pi.sqrt * t.pow(x-0.5) * |
return 2.sqrt * Num.pi.sqrt * t.pow(x-0.5) * (-t).exp * sum |
||
} |
} |
||
// Static alternatives to instance methods in Num class. |
|||
// Clearer when both arguments are complex expressions. |
|||
static min(x, y) { (x < y) ? x : y } |
|||
static max(x, y) { (x > y) ? x : y } |
|||
static atan(x, y) { x.atan(y) } |
|||
} |
} |
||