I study the behavior of spatial curves and it is very convenient to write curvature and torsion as pure functions (PF).
It is often necessary to obtain their combinations, integrals and differentiates as pure functions also.
For example, we have curvature as crv = Log[1+#]&
or smth like this.
Fortunately crv'
directly produce PF.
But further there are difficulties. For sphere there is an equation for torsion:
trs = crv'/(crv Sqrt[crv^2 - 1])
But we don’t get PF if we just put crv
.
In this post it is proposed to enter mergeF
as
mergeF[expr_] := Function @@ (Hold[expr] /. Function[body_] :> body)
so mergeF[crv'/(crv Sqrt[crv^2 - 1])]
produce needed result:
1/(Log[1 + #1] Sqrt[-1 + Log[1 + #1]^2] (1 + #1)) &
In other cases it is necessary to obtain an integral from crv
also as PF.
I found only a naive way to do it, and same I found here:
intCrv = Evaluate[Integrate[crv[s], {s, 0, #}]] &
But it looks unnatural, and also gives an answer with conditions that I don’t need.
And if we try to integrate a combination of PF, everything is confused at all.
The question arises whether there is a universal natural way (not list of tricks for possible special cases) to operate with PF to get PF?
Clarification
Let $f_1, f_2, \dots$ - some simple enough scalar functions as pure functions in Mathematica.
We know that:
f'
is a PFDerivative[-1][f]
is a PF (thanks to @xzczd)- If
expr
is a combination of PF thenmergeF[expr]
is PF
But I can’t figure out how to get PF universally as result from smth like this (and more complicated expressions):
$$\int \left(f_1 \cdot \left( \int f_2 \cdot f'_3 \right)\right)$$
Derivative[-1][crv]
orIntegrate[crv@#, #] // Evaluate // Function
? $\endgroup$trs*crv // mergeF // Derivative[-1]
? $\endgroup$mergeF
to resolve all expressions, but apparently this is difficult $\endgroup$