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.
systems-of-equations partial-derivative implicit-differentiation
add a comment |
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.
systems-of-equations partial-derivative implicit-differentiation
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
add a comment |
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.
systems-of-equations partial-derivative implicit-differentiation
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
systems-of-equations partial-derivative implicit-differentiation
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 19 at 21:30
dacfer
689
689
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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