I have a function myFunc which I is to be displayed cleanly if arguments are symbolic, but which can also be numerically evaluated. I do this by defining a complicated auxiliary function pR which is evaluated only if its arguments are numerical (probably not a good idea?).
kin[a_, b_, c_] = a^2 + b^2 + c^2 - 2 a b - 2 a c - 2 b c;
pR[s_?NumericQ, m0_?NumericQ, m1_?NumericQ] :=
1/s*Sqrt[kin[s, m0^2, m1^2]]*Log[(2 m0 m1)/(-s + m0^2 + m1^2 - Sqrt[kin[s, m0^2, m1^2]])]
The function (watered-down) I wish to define is
myFunc[n_?IntegerQ, s_, m0_, m1_] :=
Sum[
Binomial[n + 1, 2 idx3 + 1]*((s + m0^2 - m1^2)/(2 s))^(n - 2 idx3)
*(kin[s, m0^2, m1^2]/(4 s^2))^idx3, {idx3, 0, (n + 1)/2}] pR[s, m0, m1];
So for example:
myFunc[4,s,m,m]//Simplify
(* ((m^4 - 3 m^2 s + s^2) pR[s, m, m])/s^2 *)
and the complicated mess is in pR.
The problem I'm running into is:
- I don't know how to code it so that the user can forcibly display the function
pRin its entirety -- even if its arguments are symbolic, overriding the?NumericQ. - I would like to be able to take derivatives (
D),Limits, and perform a TaylorSeriesexpansion onmyFuncappropriately handling the auxiliary functionpR. This should trigger the override in the previous point.
Any ideas? Thanks!

?NumericQat all here. Why did you use it? – Szabolcs Jan 8 at 20:59?NumericQ, then the output of my examplemyFunc[4,s,m,m]would be drastically more complicated. – QuantumDot Jan 8 at 21:12pR. If you need the full expression (for numeric evaluation, series expansion, etc.), justReplaceAllthat inert head withpR:expr /. someHead -> pR. – Szabolcs Jan 8 at 21:26expandPRwhich contains the definition ofpR. I find that unnecessarily complicated. – Szabolcs Jan 8 at 21:29