\[\left(\left(-1000 \leq a \land a \leq 1000\right) \land \left(-100 \leq n \land n \leq 100\right)\right) \land \left(-1000 \leq b \land b \leq 1000\right)\]
Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[{a}^{n} - {b}^{n}
\]
↓
\[{n}^{2} \cdot \left(0.5 \cdot {\log a}^{2} + {\log b}^{2} \cdot -0.5\right) + \left(n \cdot \log \left(\frac{a}{b}\right) + \left({n}^{3} \cdot \left(0.16666666666666666 \cdot {\log a}^{3} - 0.16666666666666666 \cdot {\log b}^{3}\right) + {n}^{4} \cdot \left(0.041666666666666664 \cdot {\log a}^{4} + {\log b}^{4} \cdot -0.041666666666666664\right)\right)\right)
\]
(FPCore (a n b) :precision binary64 (- (pow a n) (pow b n))) ↓
(FPCore (a n b)
:precision binary64
(+
(* (pow n 2.0) (+ (* 0.5 (pow (log a) 2.0)) (* (pow (log b) 2.0) -0.5)))
(+
(* n (log (/ a b)))
(+
(*
(pow n 3.0)
(-
(* 0.16666666666666666 (pow (log a) 3.0))
(* 0.16666666666666666 (pow (log b) 3.0))))
(*
(pow n 4.0)
(+
(* 0.041666666666666664 (pow (log a) 4.0))
(* (pow (log b) 4.0) -0.041666666666666664))))))) double code(double a, double n, double b) {
return pow(a, n) - pow(b, n);
}
↓
double code(double a, double n, double b) {
return (pow(n, 2.0) * ((0.5 * pow(log(a), 2.0)) + (pow(log(b), 2.0) * -0.5))) + ((n * log((a / b))) + ((pow(n, 3.0) * ((0.16666666666666666 * pow(log(a), 3.0)) - (0.16666666666666666 * pow(log(b), 3.0)))) + (pow(n, 4.0) * ((0.041666666666666664 * pow(log(a), 4.0)) + (pow(log(b), 4.0) * -0.041666666666666664)))));
}
real(8) function code(a, n, b)
real(8), intent (in) :: a
real(8), intent (in) :: n
real(8), intent (in) :: b
code = (a ** n) - (b ** n)
end function
↓
real(8) function code(a, n, b)
real(8), intent (in) :: a
real(8), intent (in) :: n
real(8), intent (in) :: b
code = ((n ** 2.0d0) * ((0.5d0 * (log(a) ** 2.0d0)) + ((log(b) ** 2.0d0) * (-0.5d0)))) + ((n * log((a / b))) + (((n ** 3.0d0) * ((0.16666666666666666d0 * (log(a) ** 3.0d0)) - (0.16666666666666666d0 * (log(b) ** 3.0d0)))) + ((n ** 4.0d0) * ((0.041666666666666664d0 * (log(a) ** 4.0d0)) + ((log(b) ** 4.0d0) * (-0.041666666666666664d0))))))
end function
public static double code(double a, double n, double b) {
return Math.pow(a, n) - Math.pow(b, n);
}
↓
public static double code(double a, double n, double b) {
return (Math.pow(n, 2.0) * ((0.5 * Math.pow(Math.log(a), 2.0)) + (Math.pow(Math.log(b), 2.0) * -0.5))) + ((n * Math.log((a / b))) + ((Math.pow(n, 3.0) * ((0.16666666666666666 * Math.pow(Math.log(a), 3.0)) - (0.16666666666666666 * Math.pow(Math.log(b), 3.0)))) + (Math.pow(n, 4.0) * ((0.041666666666666664 * Math.pow(Math.log(a), 4.0)) + (Math.pow(Math.log(b), 4.0) * -0.041666666666666664)))));
}
def code(a, n, b):
return math.pow(a, n) - math.pow(b, n)
↓
def code(a, n, b):
return (math.pow(n, 2.0) * ((0.5 * math.pow(math.log(a), 2.0)) + (math.pow(math.log(b), 2.0) * -0.5))) + ((n * math.log((a / b))) + ((math.pow(n, 3.0) * ((0.16666666666666666 * math.pow(math.log(a), 3.0)) - (0.16666666666666666 * math.pow(math.log(b), 3.0)))) + (math.pow(n, 4.0) * ((0.041666666666666664 * math.pow(math.log(a), 4.0)) + (math.pow(math.log(b), 4.0) * -0.041666666666666664)))))
function code(a, n, b)
return Float64((a ^ n) - (b ^ n))
end
↓
function code(a, n, b)
return Float64(Float64((n ^ 2.0) * Float64(Float64(0.5 * (log(a) ^ 2.0)) + Float64((log(b) ^ 2.0) * -0.5))) + Float64(Float64(n * log(Float64(a / b))) + Float64(Float64((n ^ 3.0) * Float64(Float64(0.16666666666666666 * (log(a) ^ 3.0)) - Float64(0.16666666666666666 * (log(b) ^ 3.0)))) + Float64((n ^ 4.0) * Float64(Float64(0.041666666666666664 * (log(a) ^ 4.0)) + Float64((log(b) ^ 4.0) * -0.041666666666666664))))))
end
function tmp = code(a, n, b)
tmp = (a ^ n) - (b ^ n);
end
↓
function tmp = code(a, n, b)
tmp = ((n ^ 2.0) * ((0.5 * (log(a) ^ 2.0)) + ((log(b) ^ 2.0) * -0.5))) + ((n * log((a / b))) + (((n ^ 3.0) * ((0.16666666666666666 * (log(a) ^ 3.0)) - (0.16666666666666666 * (log(b) ^ 3.0)))) + ((n ^ 4.0) * ((0.041666666666666664 * (log(a) ^ 4.0)) + ((log(b) ^ 4.0) * -0.041666666666666664)))));
end
code[a_, n_, b_] := N[(N[Power[a, n], $MachinePrecision] - N[Power[b, n], $MachinePrecision]), $MachinePrecision]
↓
code[a_, n_, b_] := N[(N[(N[Power[n, 2.0], $MachinePrecision] * N[(N[(0.5 * N[Power[N[Log[a], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[b], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(n * N[Log[N[(a / b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[n, 3.0], $MachinePrecision] * N[(N[(0.16666666666666666 * N[Power[N[Log[a], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * N[Power[N[Log[b], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[n, 4.0], $MachinePrecision] * N[(N[(0.041666666666666664 * N[Power[N[Log[a], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[b], $MachinePrecision], 4.0], $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{a}^{n} - {b}^{n}
↓
{n}^{2} \cdot \left(0.5 \cdot {\log a}^{2} + {\log b}^{2} \cdot -0.5\right) + \left(n \cdot \log \left(\frac{a}{b}\right) + \left({n}^{3} \cdot \left(0.16666666666666666 \cdot {\log a}^{3} - 0.16666666666666666 \cdot {\log b}^{3}\right) + {n}^{4} \cdot \left(0.041666666666666664 \cdot {\log a}^{4} + {\log b}^{4} \cdot -0.041666666666666664\right)\right)\right)