I have lengthy second order derivative of a function that is defined with multiple lines of variables. When I compute the derivative how can I put back into the computed result the auxilary variables I defined previously (Kp
, sp
, d1
, d2
, V
)? I tried Simplify
and Reduce
with no success.
Kp = F2 + K;
sp = Sqrt[s1 + (s2 F2 /Kp)^2 - 2 \[Rho] s1 s2 F2/Kp];
d1 = 1/(sp Sqrt[T]) (Log[F1/Kp] + sp^2/2 T);
d2 = d1 - sp Sqrt[T];
V = E^(-r T) (F1 CDF[NormalDistribution[], d1] -
Kp CDF[NormalDistribution[], d2]);
D[V, {s1, 2}]
Judging from the formulas the final answer can't be that bad.
Kp, sp, d1, d2, V
are defined as variables with values, then their values will only show up in the final result. Only symbols with no value will show in the final result, as Mathematica will automatically replace any name with its value. If you mean you want to reconstruct from the final result, the original variable names in the final solution, that will be an impossible task because the values have been used already. Btw, a simpler MWE to illustrate this question would be better. It is possible I missuderstood what you want. $\endgroup$Kp = F2 + K
, then useKp
in computation, the output no longer containKp
but contains onlyF2
andk
and these could be any where in the final expression of the solution. What you seem to want, is to look forF2+K
in the solution and rewrite this asKp
. Is this right? If so, this is impossible in general. But again, a simple MWE could be better. $\endgroup$