2
$\begingroup$

Suppose we have this differential equation:

$$ x^2 + y^2 + z^2 = \frac{\frac{\partial y}{\partial x}}{x+y+z}$$

I want to find $\frac{\partial y}{\partial x}$ at x=1,y=1,z=1. I tried this code but doesn't work..

eqn[x_, y_, z_] := x^2 + y^2 + z^2 == D[y[x, z], x]/(x + y + z)

Solve[ eqn[1, 1, 1], D[y[x, z], x] ]

I get an error saying "General::ivar: 1 is not a valid variable."

I restarted mathematica and the error persists.


Too long for a comment - Your answer works, but I improvised this to my current problem and it doesn't seem to work..

Clear["Global`*"]
C1 = 10^(-10);
C2 = 0.1*C1;
R = 50;
Tb = 0.1;
Geb = 5*10^-15;
Z0 = 50;
L[Te_] := 10^-9 + 10^-9*(Te - 0.1);
Zlcr[Te_, w_] := (1/R + 1/(I*L[Te]*w) + I*C1*w)^-1;
Zload[Te_, w_] := -I*w*C2 + Zlcr[Te, w];
\[CapitalGamma][Te_, w_] := (Zload[Te, w] - Z0)/(Zload[Te, w] + Z0);
x[Te_, w_] := Abs[\[CapitalGamma][Te, w]];
y[Te_, w_] := (Abs[\[CapitalGamma][Te, w]])^2;


eqn1 [Te_, Pprobe_, w_] := 1 - 2 Pprobe*D[x[Te, w], Plocal] ==  Geb*D[Te, Plocal]
a = Solve[eqn1 [Te, Pprobe, w], D[Te, Plocal] ]
b = D[Te, Plocal]  /. a
b /. {Te -> 1, Plocal -> 1, w -> 1}
$\endgroup$
2
  • $\begingroup$ Te is an undefined symbol, so that D[Te, Plocal] immediately evaluates to zero (ie before Solve starts to work on it). You need to tell mathematica Te depends on Plocal, ie. use D[Te[Plocal], Plocal], or likely better dont use D function at all and use a symbol such as dTedPlocal both in the equation and in Solve $\endgroup$
    – george2079
    Commented Jul 14, 2014 at 18:41
  • 1
    $\begingroup$ note you have the same issue with D[x[Te, w], Plocal]. x[Te,w] has no apparent dependency on Plocal so this is zero, hence your equation as written is just ` 1 + 0 == 0 ` which just evaluates to False $\endgroup$
    – george2079
    Commented Jul 14, 2014 at 18:47

1 Answer 1

3
$\begingroup$

This gives the solution to the equation:

temp = Solve[eqn[x, y, z], D[y[x, z], x]]

This extracts the value of the rule:

res = D[y[x, z], x] /. temp

This evaluates the result at the requested coordinates:

res /. {x -> 1, y -> 1, z -> 1}

(* {9} *)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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