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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












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.










share|improve this question



























    up vote
    2
    down vote

    favorite












    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.










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      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.










      share|improve this question















      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.







      calculus-and-analysis functions function-construction symbolic complex






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 22 at 19:14









      kglr

      163k8188387




      163k8188387










      asked Sep 22 at 18:02









      Thela Hun Ginjeet

      445




      445




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Use the FullForm of the derivatives:



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


          enter image description here



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


          enter image description here






          share|improve this answer


















          • 1




            Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
            – Thela Hun Ginjeet
            Sep 23 at 10:50










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182365%2fhow-to-declare-derivatives-of-a-multivariable-function-as-real-in-order-to-get-r%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          Use the FullForm of the derivatives:



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


          enter image description here



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


          enter image description here






          share|improve this answer


















          • 1




            Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
            – Thela Hun Ginjeet
            Sep 23 at 10:50














          up vote
          3
          down vote



          accepted










          Use the FullForm of the derivatives:



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


          enter image description here



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


          enter image description here






          share|improve this answer


















          • 1




            Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
            – Thela Hun Ginjeet
            Sep 23 at 10:50












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          Use the FullForm of the derivatives:



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


          enter image description here



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


          enter image description here






          share|improve this answer














          Use the FullForm of the derivatives:



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


          enter image description here



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


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 22 at 20:17

























          answered Sep 22 at 18:48









          kglr

          163k8188387




          163k8188387







          • 1




            Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
            – Thela Hun Ginjeet
            Sep 23 at 10:50












          • 1




            Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
            – Thela Hun Ginjeet
            Sep 23 at 10:50







          1




          1




          Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
          – Thela Hun Ginjeet
          Sep 23 at 10:50




          Great, it works! Form Derivative[_, _][g][_, _] allows for generalizing to arbitrary number of derivatives.
          – Thela Hun Ginjeet
          Sep 23 at 10:50

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182365%2fhow-to-declare-derivatives-of-a-multivariable-function-as-real-in-order-to-get-r%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?