Skip to main content
deleted 45 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Re and Im work properly, with appropriate assumptions, in the example like this

  Assuming[g[_, _] \[Element] Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

 Assuming[(r | g[_, _] | D[g[_, _], _]) \[Element] Reals, 
 Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

 Assuming[(r | g[_, _] | f[_]) \[Element] Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^\[Prime]f^′)[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.

Re and Im work properly, with appropriate assumptions, in the example like this

  Assuming[g[_, _] \[Element] Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

 Assuming[(r | g[_, _] | D[g[_, _], _]) \[Element] Reals, 
 Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

 Assuming[(r | g[_, _] | f[_]) \[Element] Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^\[Prime])[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.

Re and Im work properly, with appropriate assumptions, in the example like this

Assuming[g[_, _]  Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

Assuming[(r | g[_, _] | D[g[_, _], _])  Reals, Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

Assuming[(r | g[_, _] | f[_])  Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^′)[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.

added 4 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

ReRe and ImIm work properly, with appropriate assumptions, in the example like this

  Assuming[g[_, _] \[Element] Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

 Assuming[(r | g[_, _] | D[g[_, _], _]) \[Element] Reals, 
 Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

 Assuming[(r | g[_, _] | f[_]) \[Element] Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^\[Prime])[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.

Re and Im work properly, with appropriate assumptions, in the example like this

  Assuming[g[_, _] \[Element] Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

 Assuming[(r | g[_, _] | D[g[_, _], _]) \[Element] Reals, 
 Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

 Assuming[(r | g[_, _] | f[_]) \[Element] Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^\[Prime])[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.

Re and Im work properly, with appropriate assumptions, in the example like this

  Assuming[g[_, _] \[Element] Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

 Assuming[(r | g[_, _] | D[g[_, _], _]) \[Element] Reals, 
 Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

 Assuming[(r | g[_, _] | f[_]) \[Element] Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^\[Prime])[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.

Source Link

How to declare derivatives of a multivariable function as real in order to get Re and Im part of the expression?

Re and Im work properly, with appropriate assumptions, in the example like this

  Assuming[g[_, _] \[Element] Reals, Simplify[Im[3*I*g[r, r2] + 45]]]

On the other hand, if the derivative of the function is also present, similar approach does not work

 Assuming[(r | g[_, _] | D[g[_, _], _]) \[Element] Reals, 
 Simplify[Im[3*I*D[g[r, r2], r] + 45]]]

i.e. does not give back 3*D[g[r, r2], r]

More dramatically,

 Assuming[(r | g[_, _] | f[_]) \[Element] Reals, Simplify[Im[3*I*(D[g[r, r2]*f[r], r]) + 45]]]

gives 3 Re[g[r,r2] (f^\[Prime])[r]+f[r] (g^(1,0))[r,r2]].

In real problem, I have the function of four variables and mixed partial derivatives, so it would be great if there is some generic way to prescribe all of function's derivatives as Real.