0
$\begingroup$

I want to re-express the variable z and p in the following form:

func = (z + p)+(z*p)^3+ z^3+ p^2 /.z-> Dx*Exp[x*z+y*p]/.p-> Dy*Exp[x*z+y*p]

where Dx and Dy are the derivative acting on x and y. Now by integrating and manipulating func, I want to explicitly take the derivative Dx and Dy like D[Exp[..],x] and setting x->0 and y->0.

Can somebody help me out how to do this

$\endgroup$
2
  • 1
    $\begingroup$ Either use HoldForm on the derivative replacements, or hold subscript \[PartialD] (∂) and remove the asterisks, which would look like this: func = (z + p) + (z*p)^3 + z^3 + p^2 /. {z -> HoldForm[\!\( \*SubscriptBox[\(\[PartialD]\), \(x\)]\(Exp[x*z + y*p]\)\)]} /. p -> HoldForm[\!\( \*SubscriptBox[\(\[PartialD]\), \(y\)]\(Exp[x*z + y*p]\)\)] $\endgroup$
    – flinty
    Commented Jul 3, 2020 at 15:16
  • $\begingroup$ Thanks for the answer $\endgroup$
    – NeAr
    Commented Jul 3, 2020 at 15:24

1 Answer 1

2
$\begingroup$
func = ((z + p) + (z*p)^3 + z^3 + p^2 /. 
  {z -> HoldForm[D[Exp[x*z + y*p], x]]}) /. 
    {p -> HoldForm[D[Exp[x*z + y*p], y]]}

(* evaluate derivatives *)
evderiv = ReleaseHold //@ func

(* result: E^(p y + x z) p + E^(2 p y + 2 x z) p^2 + 
 E^(E^(p y + x z) p y + x z) (z + E^(p y + x z) p y z) + 
 E^(3 E^(p y + x z) p y + 3 x z) (z + E^(p y + x z) p y z)^3 + 
 E^(3 p y + 3 E^(p y + x z) p y + 6 x z)
   p^3 (z + E^(p y + x z) p y z)^3 *)

evderiv /. {x -> 0, y -> 0}

(* result: p + p^2 + z + z^3 + p^3 z^3 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.