Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = (1 + Exp[-(Sqrt[x*x + M*M] - mu)/T])
- CForm[D[f, M]]
- -((Power(E,(mu - Sqrt(Power(M,2) + Power(x,2)))/T)*M)/
- (T*Sqrt(Power(M,2) + Power(x,2))))
- ClearAll[foo]
- foo = RawBoxes[Replace[ToBoxes@#, InterpretationBox[a_, b_, c___] :>
- With[{aa = StringReplace[a,
- { "Sqrt" -> "sqrt", "Power(E," -> "exp(", "Power" -> "pow"}]}, aa],
- {0, Infinity}]] &;
- foo@CForm[D[f, M]]
- Unprotect[Power];
- Format[Power[E, a_], CForm] := exp[a]
- Format[Power[a_, 1/2], CForm] := sqrt[a]
- Format[Power[a_, b_], CForm] := pow[a, b]
- Protect[Power];
- D[f, M] //CForm
Add Comment
Please, Sign In to add comment