0
$\begingroup$

I have a function that includes another function inside. I want to know the derivative at every point x. I have spent a lot of time trying to figure out how to do this, but I am very lost. I have searched on here without luck.

y = 70000.;
t = 350.;
f = 3000.;
ta = 250.;
fa = 1000.;
u = 3000.;
(* elasticity of income *)
\[Gamma] = 0.2;
(* price elasticity of housing *)
\[Epsilon] = -0.6;
(* constant in demand function *)
\[Omega] = 7.34074;

And the two functions:

p[x_, y_, t_, ta_, f_, fa_, u_] := (E^\[Omega]*(\[Epsilon]+1)*((y-(f+fa)-(t+ta)*x)^(1-\[Gamma])/(1-\[Gamma])-u))^(1/(\[Epsilon]+1));
q[x_, y_, t_, ta_, f_, fa_, u_] := (1-\[Gamma])^(\[Gamma]/(1-\[Gamma]))*E^\[Omega]*p[x, y, t, ta, f, fa, u]^(\[Epsilon]+1)*((E^\[Omega]*p[x, y, t, ta, f, fa, u]

I need to know what the derivative of q is with respect to p on a graph of x.

I have tried these:

ND[q[x, y, t, ta, f, fa, u],p[x, y, t, ta, f, fa, u]];
ND[q[x, y, t, ta, f, fa, u],p];
D[q[x, y, t, ta, f, fa, u],p[x, y, t, ta, f, fa, u]];
D[q[x, y, t, ta, f, fa, u],p];
ND[q[1, y, t, ta, f, fa, u],p[1, y, t, ta, f, fa, u]];
ND[q[1, y, t, ta, f, fa, u],p];
D[q[1, y, t, ta, f, fa, u],p[1, y, t, ta, f, fa, u]];
D[q[1, y, t, ta, f, fa, u],p];

None of it gave any meaningful results. I only want to know if the result is negative at all given x'es.

$\endgroup$
4
  • $\begingroup$ So you are trying to compute D[(1 - \[Gamma])^(\[Gamma]/(1 - \[Gamma]))*E^\[Omega]*p^(\[Epsilon] + 1)*((E^\[Omega]*p )), p]? If so, you can do that and then substitute for p. $\endgroup$
    – Alan
    Jun 1 at 13:35
  • $\begingroup$ @Alan When I do that, I get an equation rather than a number. I would like to see if the result is positive or negative. $\endgroup$ Jun 2 at 14:40
  • $\begingroup$ After you substitute for p[x,params] you also need to substitute forparams; this will produce an express in x. $\endgroup$
    – Alan
    Jun 2 at 21:12
  • $\begingroup$ I created an answer to show what I mean in more detail. $\endgroup$
    – Alan
    Jun 3 at 15:18

2 Answers 2

1
$\begingroup$
ClearAll[x, y, t, ta, f, fa, u]
params = {y -> 70000., t -> 350., ta -> 250., f -> 3000., fa -> 1000.,u -> 3000.};
(* constants: *)
\[Gamma] = 0.2(*elasticity of income*);
\[Epsilon] = -0.6(*price elasticity of housing*);
\[Omega] = 7.34074(*constant in demand function*);

p[x_, y_, t_, ta_, f_, fa_, u_] := (E^\[Omega]*(\[Epsilon] + 1)*((y - (f + fa) - (t + ta)*x)^(1 - \[Gamma])/(1 - \[Gamma]) - u))^(1/(\[Epsilon] + 1));
q = (1 - \[Gamma])^(\[Gamma]/(1 - \[Gamma]))*E^\[Omega]*p^(\[Epsilon] + 1)*(E^\[Omega]*p);
D[q, p] // Simplify   (* as requested *)
fx = % /. {p -> p[x, y, t, ta, f, fa, u]} /. params // PowerExpand
Plot[fx, {x, 0, 200}]

enter image description here

$\endgroup$
1
  • $\begingroup$ exactly what I was looking for. Thank you so much. $\endgroup$ Jun 7 at 12:01
1
$\begingroup$

I understand that you want to calculate dp/dq. That is the ratio of the change of p to the change of q if x is changed an infinite small amount.

To make it simpler I insert the constants and define:

p[x_] = 9.446200643449517`*^6 (-3000.` + 
     1.25` (-1000.` - f - (250.` + t) x + y)^0.8`)^2.5`;
q[x_] = 1.3098400921578258`*^16 ((-3000.` + 
      1.25` (-1000.` - f - (250.` + t) x + y)^0.8`)^2.5`)^1.4`;

The differential quotient dp/dq is then:

p`[x] / q'[x]

enter image description here

and dq/dp:

enter image description here

$\endgroup$
2
  • $\begingroup$ It's actually the opposite. I want to take dq/dp. Preferably I would like to get a number so I can see if it's positive or negative. I actually just want to know what happens to q as we increase p by 1. Does it increase or decrease? $\endgroup$ Jun 2 at 14:39
  • 1
    $\begingroup$ dq/dp is simply the inverse of dp/dq. I added this to the answer. $\endgroup$ Jun 2 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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