Partial derivative calculation for circular or iterative functions











up vote
0
down vote

favorite












I have a question of partial derivatives for implicit functions. I have three equations:



$rho_k=rho_lfrac{lambda_l}{H_l}+rho_gfrac{(1-lambda_l)}{1-H_l}$
$Re=frac{rho_kv_mphi}{mu}$
$H_l=f(Re,lambda_l)$



$phi$ is a constant and $f()$ is a complex function. $rho_l,rho_g,lambda_l,v_m,mu$ are all functions of $P$ (and $Q$). I solve these iteratively for $H_l$ given $P$ and $Q$. Now I need $frac{partial H_l}{partial P}$. I do this by differentiating all three equations:



$frac{partial rho_k}{partial P}=frac{partial rho_k}{partial rho_l}frac{partial rho_l}{partial P}+frac{partial rho_k}{partial rho_g}frac{partial rho_g}{partial P}+frac{partial rho_k}{partial lambda_l}frac{partial lambda_l}{partial P}+frac{partial rho_k}{partial H_l}frac{partial H_l}{partial P}$
$frac{partial Re}{partial P}=frac{partial Re}{partial rho_k}frac{partial rho_k}{partial P}+frac{partial Re}{partial v_m}frac{partial v_m}{partial P}+frac{partial Re}{partial mu}frac{partial mu}{partial P}$
$frac{partial H_L}{partial P}=frac{partial H_L}{partial Re}frac{partial Re}{partial P}+frac{partial H_L}{partial lambda_l}frac{partial lambda_l}{partial P}$



I can solve these for $frac{partial H_L}{partial P}$ if I have all the other derivatives.

However I have a question on how I calculate some of the other derivatives needed, in particular $frac{partial rho_k}{partial lambda_l}$ ? Do I keep $H_l$ constant or do I need to take into consideration $frac{partial H_L}{partial lambda_l}$ ?

Mathematically, is $frac{partial rho_k}{partial lambda_l}$ equal to:



$rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$, or



$rho_lfrac{2.0H_llambda_l-lambda_l^2frac{partial H_L}{partial lambda_l}}{H_l^2}-rho_gfrac{2.0(1.0-H_l)(1.0-lambda_l)+(1-lambda_l)^2frac{partial H_L}{partial lambda_l}}{(1.0-H_l)^2}$ ?



Neither of these formulations give the same analytical value of $frac{partial H_L}{partial P}$ as a numerical perturbation though, so I'm wondering if I am doing this all correctly.










share|cite|improve this question
























  • How is $x_2$ both a function of $(x_1,y_1)$ and of $(P,Q)$? It seems you are abusing notation and using $x_2$ to refer to a variable, a function of $(x_1,x_2)$ and a function of $(P,Q)$. Sorting out the notation, and defining the functions more carefully might help. Perhaps an example might be helpful too.
    – smcc
    Nov 17 at 16:37












  • I have now added my real world example as my simplification using x and y might not have shown all the subtleties of the original problem.
    – dacfer
    Nov 17 at 17:27










  • In fact I removed the simplification. Just the real world problem there now.
    – dacfer
    Nov 17 at 17:43

















up vote
0
down vote

favorite












I have a question of partial derivatives for implicit functions. I have three equations:



$rho_k=rho_lfrac{lambda_l}{H_l}+rho_gfrac{(1-lambda_l)}{1-H_l}$
$Re=frac{rho_kv_mphi}{mu}$
$H_l=f(Re,lambda_l)$



$phi$ is a constant and $f()$ is a complex function. $rho_l,rho_g,lambda_l,v_m,mu$ are all functions of $P$ (and $Q$). I solve these iteratively for $H_l$ given $P$ and $Q$. Now I need $frac{partial H_l}{partial P}$. I do this by differentiating all three equations:



$frac{partial rho_k}{partial P}=frac{partial rho_k}{partial rho_l}frac{partial rho_l}{partial P}+frac{partial rho_k}{partial rho_g}frac{partial rho_g}{partial P}+frac{partial rho_k}{partial lambda_l}frac{partial lambda_l}{partial P}+frac{partial rho_k}{partial H_l}frac{partial H_l}{partial P}$
$frac{partial Re}{partial P}=frac{partial Re}{partial rho_k}frac{partial rho_k}{partial P}+frac{partial Re}{partial v_m}frac{partial v_m}{partial P}+frac{partial Re}{partial mu}frac{partial mu}{partial P}$
$frac{partial H_L}{partial P}=frac{partial H_L}{partial Re}frac{partial Re}{partial P}+frac{partial H_L}{partial lambda_l}frac{partial lambda_l}{partial P}$



I can solve these for $frac{partial H_L}{partial P}$ if I have all the other derivatives.

However I have a question on how I calculate some of the other derivatives needed, in particular $frac{partial rho_k}{partial lambda_l}$ ? Do I keep $H_l$ constant or do I need to take into consideration $frac{partial H_L}{partial lambda_l}$ ?

Mathematically, is $frac{partial rho_k}{partial lambda_l}$ equal to:



$rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$, or



$rho_lfrac{2.0H_llambda_l-lambda_l^2frac{partial H_L}{partial lambda_l}}{H_l^2}-rho_gfrac{2.0(1.0-H_l)(1.0-lambda_l)+(1-lambda_l)^2frac{partial H_L}{partial lambda_l}}{(1.0-H_l)^2}$ ?



Neither of these formulations give the same analytical value of $frac{partial H_L}{partial P}$ as a numerical perturbation though, so I'm wondering if I am doing this all correctly.










share|cite|improve this question
























  • How is $x_2$ both a function of $(x_1,y_1)$ and of $(P,Q)$? It seems you are abusing notation and using $x_2$ to refer to a variable, a function of $(x_1,x_2)$ and a function of $(P,Q)$. Sorting out the notation, and defining the functions more carefully might help. Perhaps an example might be helpful too.
    – smcc
    Nov 17 at 16:37












  • I have now added my real world example as my simplification using x and y might not have shown all the subtleties of the original problem.
    – dacfer
    Nov 17 at 17:27










  • In fact I removed the simplification. Just the real world problem there now.
    – dacfer
    Nov 17 at 17:43















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a question of partial derivatives for implicit functions. I have three equations:



$rho_k=rho_lfrac{lambda_l}{H_l}+rho_gfrac{(1-lambda_l)}{1-H_l}$
$Re=frac{rho_kv_mphi}{mu}$
$H_l=f(Re,lambda_l)$



$phi$ is a constant and $f()$ is a complex function. $rho_l,rho_g,lambda_l,v_m,mu$ are all functions of $P$ (and $Q$). I solve these iteratively for $H_l$ given $P$ and $Q$. Now I need $frac{partial H_l}{partial P}$. I do this by differentiating all three equations:



$frac{partial rho_k}{partial P}=frac{partial rho_k}{partial rho_l}frac{partial rho_l}{partial P}+frac{partial rho_k}{partial rho_g}frac{partial rho_g}{partial P}+frac{partial rho_k}{partial lambda_l}frac{partial lambda_l}{partial P}+frac{partial rho_k}{partial H_l}frac{partial H_l}{partial P}$
$frac{partial Re}{partial P}=frac{partial Re}{partial rho_k}frac{partial rho_k}{partial P}+frac{partial Re}{partial v_m}frac{partial v_m}{partial P}+frac{partial Re}{partial mu}frac{partial mu}{partial P}$
$frac{partial H_L}{partial P}=frac{partial H_L}{partial Re}frac{partial Re}{partial P}+frac{partial H_L}{partial lambda_l}frac{partial lambda_l}{partial P}$



I can solve these for $frac{partial H_L}{partial P}$ if I have all the other derivatives.

However I have a question on how I calculate some of the other derivatives needed, in particular $frac{partial rho_k}{partial lambda_l}$ ? Do I keep $H_l$ constant or do I need to take into consideration $frac{partial H_L}{partial lambda_l}$ ?

Mathematically, is $frac{partial rho_k}{partial lambda_l}$ equal to:



$rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$, or



$rho_lfrac{2.0H_llambda_l-lambda_l^2frac{partial H_L}{partial lambda_l}}{H_l^2}-rho_gfrac{2.0(1.0-H_l)(1.0-lambda_l)+(1-lambda_l)^2frac{partial H_L}{partial lambda_l}}{(1.0-H_l)^2}$ ?



Neither of these formulations give the same analytical value of $frac{partial H_L}{partial P}$ as a numerical perturbation though, so I'm wondering if I am doing this all correctly.










share|cite|improve this question















I have a question of partial derivatives for implicit functions. I have three equations:



$rho_k=rho_lfrac{lambda_l}{H_l}+rho_gfrac{(1-lambda_l)}{1-H_l}$
$Re=frac{rho_kv_mphi}{mu}$
$H_l=f(Re,lambda_l)$



$phi$ is a constant and $f()$ is a complex function. $rho_l,rho_g,lambda_l,v_m,mu$ are all functions of $P$ (and $Q$). I solve these iteratively for $H_l$ given $P$ and $Q$. Now I need $frac{partial H_l}{partial P}$. I do this by differentiating all three equations:



$frac{partial rho_k}{partial P}=frac{partial rho_k}{partial rho_l}frac{partial rho_l}{partial P}+frac{partial rho_k}{partial rho_g}frac{partial rho_g}{partial P}+frac{partial rho_k}{partial lambda_l}frac{partial lambda_l}{partial P}+frac{partial rho_k}{partial H_l}frac{partial H_l}{partial P}$
$frac{partial Re}{partial P}=frac{partial Re}{partial rho_k}frac{partial rho_k}{partial P}+frac{partial Re}{partial v_m}frac{partial v_m}{partial P}+frac{partial Re}{partial mu}frac{partial mu}{partial P}$
$frac{partial H_L}{partial P}=frac{partial H_L}{partial Re}frac{partial Re}{partial P}+frac{partial H_L}{partial lambda_l}frac{partial lambda_l}{partial P}$



I can solve these for $frac{partial H_L}{partial P}$ if I have all the other derivatives.

However I have a question on how I calculate some of the other derivatives needed, in particular $frac{partial rho_k}{partial lambda_l}$ ? Do I keep $H_l$ constant or do I need to take into consideration $frac{partial H_L}{partial lambda_l}$ ?

Mathematically, is $frac{partial rho_k}{partial lambda_l}$ equal to:



$rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$, or



$rho_lfrac{2.0H_llambda_l-lambda_l^2frac{partial H_L}{partial lambda_l}}{H_l^2}-rho_gfrac{2.0(1.0-H_l)(1.0-lambda_l)+(1-lambda_l)^2frac{partial H_L}{partial lambda_l}}{(1.0-H_l)^2}$ ?



Neither of these formulations give the same analytical value of $frac{partial H_L}{partial P}$ as a numerical perturbation though, so I'm wondering if I am doing this all correctly.







systems-of-equations partial-derivative implicit-differentiation






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 17 at 20:52

























asked Nov 17 at 15:53









dacfer

689




689












  • How is $x_2$ both a function of $(x_1,y_1)$ and of $(P,Q)$? It seems you are abusing notation and using $x_2$ to refer to a variable, a function of $(x_1,x_2)$ and a function of $(P,Q)$. Sorting out the notation, and defining the functions more carefully might help. Perhaps an example might be helpful too.
    – smcc
    Nov 17 at 16:37












  • I have now added my real world example as my simplification using x and y might not have shown all the subtleties of the original problem.
    – dacfer
    Nov 17 at 17:27










  • In fact I removed the simplification. Just the real world problem there now.
    – dacfer
    Nov 17 at 17:43




















  • How is $x_2$ both a function of $(x_1,y_1)$ and of $(P,Q)$? It seems you are abusing notation and using $x_2$ to refer to a variable, a function of $(x_1,x_2)$ and a function of $(P,Q)$. Sorting out the notation, and defining the functions more carefully might help. Perhaps an example might be helpful too.
    – smcc
    Nov 17 at 16:37












  • I have now added my real world example as my simplification using x and y might not have shown all the subtleties of the original problem.
    – dacfer
    Nov 17 at 17:27










  • In fact I removed the simplification. Just the real world problem there now.
    – dacfer
    Nov 17 at 17:43


















How is $x_2$ both a function of $(x_1,y_1)$ and of $(P,Q)$? It seems you are abusing notation and using $x_2$ to refer to a variable, a function of $(x_1,x_2)$ and a function of $(P,Q)$. Sorting out the notation, and defining the functions more carefully might help. Perhaps an example might be helpful too.
– smcc
Nov 17 at 16:37






How is $x_2$ both a function of $(x_1,y_1)$ and of $(P,Q)$? It seems you are abusing notation and using $x_2$ to refer to a variable, a function of $(x_1,x_2)$ and a function of $(P,Q)$. Sorting out the notation, and defining the functions more carefully might help. Perhaps an example might be helpful too.
– smcc
Nov 17 at 16:37














I have now added my real world example as my simplification using x and y might not have shown all the subtleties of the original problem.
– dacfer
Nov 17 at 17:27




I have now added my real world example as my simplification using x and y might not have shown all the subtleties of the original problem.
– dacfer
Nov 17 at 17:27












In fact I removed the simplification. Just the real world problem there now.
– dacfer
Nov 17 at 17:43






In fact I removed the simplification. Just the real world problem there now.
– dacfer
Nov 17 at 17:43












1 Answer
1






active

oldest

votes

















up vote
0
down vote













It turns out the first formulation for $frac{partial rho_k}{partial lambda_l}$ is correct, that is:



$rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$



The errors with $frac{partial H_L}{partial P}$ were in the derivatives I was calculating for $H_l=f(Re,lambda_l)$. This is a graph which I was using Bezier functions to interpolate. This works well in 1d, but 2d Bezier interpolation causes noise, resulting in erroneous derivatives.






share|cite|improve this answer





















    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: "69"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3002491%2fpartial-derivative-calculation-for-circular-or-iterative-functions%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    It turns out the first formulation for $frac{partial rho_k}{partial lambda_l}$ is correct, that is:



    $rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$



    The errors with $frac{partial H_L}{partial P}$ were in the derivatives I was calculating for $H_l=f(Re,lambda_l)$. This is a graph which I was using Bezier functions to interpolate. This works well in 1d, but 2d Bezier interpolation causes noise, resulting in erroneous derivatives.






    share|cite|improve this answer

























      up vote
      0
      down vote













      It turns out the first formulation for $frac{partial rho_k}{partial lambda_l}$ is correct, that is:



      $rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$



      The errors with $frac{partial H_L}{partial P}$ were in the derivatives I was calculating for $H_l=f(Re,lambda_l)$. This is a graph which I was using Bezier functions to interpolate. This works well in 1d, but 2d Bezier interpolation causes noise, resulting in erroneous derivatives.






      share|cite|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        It turns out the first formulation for $frac{partial rho_k}{partial lambda_l}$ is correct, that is:



        $rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$



        The errors with $frac{partial H_L}{partial P}$ were in the derivatives I was calculating for $H_l=f(Re,lambda_l)$. This is a graph which I was using Bezier functions to interpolate. This works well in 1d, but 2d Bezier interpolation causes noise, resulting in erroneous derivatives.






        share|cite|improve this answer












        It turns out the first formulation for $frac{partial rho_k}{partial lambda_l}$ is correct, that is:



        $rho_lfrac{2.0lambda_l}{H_l}-rho_gfrac{2.0(1.0-lambda_l)}{1.0-H_l}$



        The errors with $frac{partial H_L}{partial P}$ were in the derivatives I was calculating for $H_l=f(Re,lambda_l)$. This is a graph which I was using Bezier functions to interpolate. This works well in 1d, but 2d Bezier interpolation causes noise, resulting in erroneous derivatives.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Nov 19 at 21:30









        dacfer

        689




        689






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3002491%2fpartial-derivative-calculation-for-circular-or-iterative-functions%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Ellipse (mathématiques)

            Quarter-circle Tiles

            Mont Emei