/usr/share/genius/gel/symbolic/differentiation.gel is in genius-common 1.0.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | function SymbolicNthDerivative(f,n) =
(
local *;
if not IsFunction(f) then
(error("SymbolicNthDerivative: argument 1 must be a function");bailout)
else if not IsNonNegativeInteger(n) then
(error("SymbolicNthDerivative: argument 2 must be a non-negative integer");bailout);
df = f;
for k=1 to n do (
df = SymbolicDerivativeTry (df);
if IsNull(df) then
(error("SymbolicNthDerivative: Cannot differentiate function n times");bailout)
);
df
)
SetHelp("SymbolicNthDerivative","symbolic","Attempt to symbolically differentiate a function n times");
function SymbolicNthDerivativeTry(f,n) =
(
local *;
if not IsFunction(f) then
(error("SymbolicNthDerivativeTry: argument 1 must be a function");bailout)
else if not IsNonNegativeInteger(n) then
(error("SymbolicNthDerivativeTry: argument 2 must be a non-negative integer");bailout);
df = f;
for k=1 to n do (
df = SymbolicDerivativeTry (df);
if IsNull(df) then
return null
);
df
)
SetHelp("SymbolicNthDerivativeTry","symbolic","Attempt to symbolically differentiate a function n times quietly and return null on failure");
function SymbolicTaylorApproximationFunction(f,x0,n) =
(
local *;
if not IsFunction(f) then
(error("SymbolicTaylorApproximationFunction: argument 1 must be a function");bailout)
else if not IsValue(x0) then
(error("SymbolicTaylorApproximationFunction: argument 2 must be a value");bailout)
else if not IsPositiveInteger(n) then
(error("SymbolicTaylorApproximationFunction: argument 3 must be a positive integer");bailout);
df = f;
c = null;
for k=0 to n do (
c@(k+1) = (df call (x0))/(k!);
if k < n then (
df = SymbolicDerivative (df);
if IsNull(df) then
return null
)
);
tp = PolyToFunction (c);
`(x)[tp,x0] = (tp call (x - x0))
)
SetHelp("SymbolicTaylorApproximationFunction","symbolic","Attempt to construct the Taylor approximation function around x0 to the nth degree.");
|