# Plotting Contour Family of Curves

1. Jul 8, 2014

### unscientific

1. The problem statement, all variables and given/known data

So basically here's what the code is supposed to do:

$$L(T_e) = 10^{-9} (T_e - 0.1)$$
$$Z_{lcr}(T_e) = \left ( \frac{1}{R} + \frac{1}{10^9 iL} + 0.1i \right )^{-1}$$
$$Z_{load} (T_e) = Z_{lcr} - 0.01i$$
$$\Gamma (T_e) = \frac{Z_{load}(T_e) - Z_0}{Z_{load}(T_e) + Z_0}$$

The above equations are linked by this equation:

$$1 - 2 P_{probe}|\Gamma| \frac{\partial |\Gamma| }{\partial P_{local}} = G_{eb} \frac{\partial T_e}{\partial P_{local}}$$

I want to find the contours of $\frac{\partial T_e}{\partial P_{local}}$ against axes $P_{local}$ for various values of $P_{probe}, T_e(1)$ ranging from $0$ to $10^{−14}$ and $0$ to $0.1$

2. Relevant equations

3. The attempt at a solution

Code (Text):
C1 = 10^(-10);
C2 = 0.1*C1;
R = 50;
L = 10^-9 (Te - Tb);
Tb = 0.1;
Geb = 5*10^-15;
Z0 = 50;
w = 10^9;
Zlcr = (1/R + 1/(I L w) + I C1 w)^-1;
Zload = -I w C2 +  Zlcr;

1 - 2*Pprobe *Abs[\[CapitalGamma]] *D[Abs[\[CapitalGamma]], Plocal] == Geb *D[Te, Plocal]

plt[Pprobe_] :=
ParametricPlot [   {D[Te, Plocal], Plocal} , {Plocal, 0, 10^-13} ,
AspectRatio -> 1/1.5, Frame -> True, PlotStyle -> {Darker[Green]},
FrameLabel -> {Style["Plocal", 10],
Style["Electron Temperature Susceptibility", 10]},
LabelStyle -> {FontSize -> 12, FontFamily -> "Times"}   ]

Show[Table[plt[Pprobe], {Pprobe, 0, 10^-14, 10^-15}]]

Last edited: Jul 8, 2014
2. Jul 8, 2014

### Staff: Mentor

I can't help much here except to say we would need to know the language of your solution in order to comment on it and give you some suggestions.

Also some variables aren't defined in your listing like R, L, w, C1, C2, I

The definitions need to be placed before they are used in an equation for most programming languages

Also the statements shown below make no sense. They look like conditional expressions like for an IF or WHILE statement but I don't see and IF or WHILE statement.

Code (Text):

Plocal + Pprobe (1 -  Abs[Γ]^2)  == (Te - Tb) Geb
v[Plocal_, Pprobe, w] == D[Te, Plocal]

3. Jul 8, 2014

### unscientific

I'm using mathematica. I've updated my code above and drastically simplified the problem. Now what's left to do is to implicitly diffrentiate and plot $\frac{\partial T_e}{\partial P_{local}}$ against $P_{local}$ for a given family of curves given with various values of $P_{probe}$.

Differentiating $\Gamma$ to find $\frac{\partial T_e}{\partial P_{local}}$ manually is very tedious, so I want mathematica to do that for me to find $\frac{\partial T_e}{\partial P_{local}}$ and plot it.

How do I tell Mathematica to:

1. differentiate $\Gamma$ to find an expression for $\frac{\partial T_e}{\partial P_{local}}$

2. Insert in value of $T_e$ ranging from $0$ to $0.2$ and value of $P_{probe}$ ranging from $0$ to $10^{-14}$

3.Plot contours of $\frac{\partial T_e}{\partial P_{local}}$ against $P_{local}$ for various values of $P_{probe}$ and $T_e$ ?

Last edited: Jul 8, 2014
4. Jul 8, 2014

### Bill Simpson

Let's fix some of the little stuff first

Code (Text):
Geb = 5*10^-15;
Z0 = 50;
R = 50;
L[Te_] := 10^-9*(Te - 1/10);
Zlcr[Te_] := (1/R + 1/(10^9 *I* L[Te]) + I/10)^-1;
I'm assuming when you write i you mean square root of -1 and for that Mathematica uses I. I'm assuming when you write L you mean L is a function of Te and for that Mathematica uses L[Te_] to define the function and L[Te] to use the function. Likewise for Zlcr, Zload, and Gamma. I have substituted exact fractions for your decimals because you say you are going to use very small numbers, I don't want to get into roundoff or accuracy problems and don't want to wade into trying to explain that whole subject yet.

If you want to insert more names, like C1 and C2, etc, at the top of that, assign each a constant value and use those names later in the code then that might help make it easier to understand, change values and not introduce errors.

So paste that into a fresh start of Mathematica, evaluate it and then try things like Zload[4] and see if you can verify that much is all correct. Ignore for the moment you are going to get fractions instead of decimals. Does this much seem all correct thus far? If so we have made some progress. If there is anything I've misunderstood then please explain it to me and I'll try to fix it.

You could even try this

Code (Text):
Plot[{Re[\[CapitalGamma][Te]], Im[\[CapitalGamma][Te]]}, {Te, .01, 50}]
to see the real and imaginary plots overlaid.

Now we have to figure out a way I can understand your line that "relates." I'm confused. It looks a little like Sin[theta]*(differentiate Sin[theta] with respect to banana)=6*(differentiate theta with respect to banana). Both sides of that seem like they are zero because theta has nothing to do with banana as far as I can see.

If we can figure out a way to explain that line to me then perhaps I can figure out a way to explain that to Mathematica and then maybe we can get your plot.

Last edited: Jul 8, 2014
5. Jul 9, 2014

### unscientific

Code (Text):

C1 = 10^(-10);
C2 = 0.1*C1;
R = 50;
Tb = 0.1;
Geb = 5*10^-15;
Z0 = 50;
w = 10^9;
L[Te_] := 10^-9 + 10^-9 (Te - Tb);
Zlcr[Te_] := (1/R + 1/(I *L[Te]* w) + I *C1* w)^-1
Zload[Te_] := -I* w* C2 + Zlcr[Te]

eqn = Plocal +
Pprobe (1 -  (Abs[\[CapitalGamma]]^2) [Te])  == (Te - Tb)*Geb;

Solve [
D[eqn, Plocal]  /. {Te[Pprobe, Plocal] -> 0.2, Pprobe -> 10^-16,
Plocal -> 10^-15},
D[Te[Pprobe, Plocal], Plocal ]  /. {Te[Pprobe, Plocal] -> 0.2,
Pprobe -> 10^-16, Plocal -> 10^-15}

]

The first part is absolutely fine, tested it in mathematica. I tried to find a specific value of $\frac{\partial T_e}{\partial P_{local}}$ by assigning values, that didn't work either. Why can't mathematica give a value for $\frac{\partial T_e}{\partial P_{local}}$?

For the second part, the variables are linked by this equation:

$$1 - 2 P_{probe}|\Gamma| \frac{\partial |\Gamma| }{\partial P_{local}} = G_{eb} \frac{\partial T_e}{\partial P_{local}}$$

It's obvious that it is very tedious to obtain an expression for $\frac{\partial |\Gamma| }{\partial P_{local}}$, but we know it will be a function of $\frac{\partial T_e}{\partial P_{local}}$.

Now with this equation entirely in terms of $\frac{\partial T_e}{\partial P_{local}}$ and $P_{local}$ (Assuming we have assigned values for $T_e$ and $P_{probe}$), I want to find the contours of $\frac{\partial T_e}{\partial P_{local}}$ versus axis $P_{local}$.

Last edited: Jul 9, 2014
6. Jul 9, 2014

### Bill Simpson

My guess in what you think the notation means and what Mathematica thinks the notation means are different, and Mathematica uses what it thinks. Is this what you are trying to express?

Code (Text):
eqn = Plocal + Pprobe (1 - Abs[\[CapitalGamma][Te]^2]) == (Te - Tb)*Geb
In other words, first find Gamma of Te, then square that, then take the absolute value? If there are still misunderstandings in that then these need to get corrected first.

Next I don't think D is doing what you expect. Try a simpler example first to see how D works.

Code (Text):
In[18]:= eqn = a x == b x^2; D[eqn, x]

Out[18]= a == 2 b x
So D is going to differentiate each side of the equality. try that on your eqn.

Code (Text):
In[19]:= eqn=Plocal+Pprobe(1-Abs[\[CapitalGamma][Te]^2])==(Te-Tb)*Geb;D[eqn, Plocal]

Out[19]= False
Look at the previous example and this example and figure out why Mathematica thinks the answer is False. Just go back to calculus, forget everything about what all this is supposed to "mean", just brute force differentiate both sides with respect to Plocal and see what you get. You should get something==something. Are those the right somethings? If not then it is back to figuring out eqn.

Next you are trying to do

Code (Text):
D[eqn, Plocal]  /. {Te[Pprobe, Plocal]->0.2, Pprobe->10^-16, Plocal->10^-15
Mathematica sees Te[stuff] and goes looking for a function named Te because it is followed by [ and ], but you have no function named Te. Maybe you meant

Code (Text):
D[eqn, Plocal]  /. {Te->0.2, Pprobe->10^-16, Plocal->10^-15
but I can't guess at this point.

Next it is Solve[equation, variable] and I don't see you doing that in your code.

So figure out how to get eqn correct first, then figure out how to use D and then you can start on Solve.

Last edited: Jul 9, 2014
7. Jul 9, 2014

### unscientific

Not quite actually, the expression should be: $|\Gamma (T_e)|^2$.

I didn't get a false error with mine. I tried it using a simpler example with variables $x,y,z$ and it worked fine: http://mathematica.stackexchange.co...uation/52320?noredirect=1#comment154295_52320

Look at the answer by User29165, it is analogous to what I'm doing here, where variables $x,y,z$ are now $P_{local}, T_e, P_{probe}$ respectively. If it works there, there's no reason why it won't work here?

There's a Solve part in my code actually..

I'm trying to test if the code gives a value for $\frac{\partial T_e}{\partial P_{local}}$ when I specify values for $P_{local}, T_e, P_{probe}$. The next step would then be to plot family of curves $\frac{\partial T_e}{\partial P_{local}}$ against $P_{local}$ various combination of values of $(T_e, P_{probe})$

8. Jul 9, 2014

### Bill Simpson

Ah, good. Helpful hint: Look at what you originally wrote and try to figure out why Mathematica does not think what you wrote was the square of the absolute value of the gamma of Te. Really understanding Mathematica's notation for functions is going to be used constantly and getting that right is essential.

Mathematica if FANATIC about every detail of what you write. If you were writing for a bright grad student then he might not even notice when you made little errors, or he would just be "mathematically mature", which means he would figure out what you really meant and do that. Mathematica is not mathematically mature.

I don't think Mathematica thinks that is a "false error."

Try this again and then look at the derivative of each side.

Code (Text):
In[1]:= C1=10^-10; C2=1/10*C1; R=50; Tb=1/10; Geb=5*10^-15; Z0=50; w=10^9;
L[Te_] := 10^-9 + 10^-9 (Te - Tb);
Zlcr[Te_] := (1/R + 1/(I*L[Te]*w) + I*C1*w)^-1;
eqn = Plocal + Pprobe (1 - Abs[\[CapitalGamma][Te]]^2) == (Te - Tb)*Geb;

In[4]:= D[Plocal + Pprobe (1 - Abs[\[CapitalGamma][Te]]^2), Plocal]

Out[4]= 1

In[5]:= D[(Te - Tb)*Geb, Plocal]

Out[5]= 0

In[6]:= 1 == 0

Out[6]= False
So one side is 1 and the other side is 0 and 1==0 certainly seems like it is False to me, and to Mathematica. And I believe this is precisely what you asked Mathematica to do in your code, whether you realized it or not. Study this until you are completely clear why it got those two results, you are going to need that.

Have I misunderstood? Or is that exactly correct and not at all what you wanted to do? This is the question I've been asking about this tiny part of your problem since my first reply to you.

Is your example and that example both absolutely precisely correct? Or is there any tiny flaw?

I know that and I think you have a number of things to climb over before you can get anywhere near a working Solve.

I understand your "big goal." Lots of people type in a page of code and punch Go and then don't understand what any of the errors mean or why they don't get the right answer. But every little misunderstanding or syntax error means there is likely no way of even guessing how what comes out relates to the "big goal." Get the little stuff right, a line at a time and even a single function at a time. Once all the errors start getting fixed then you have a chance you might get near your goal.

Last edited: Jul 9, 2014
9. Jul 10, 2014

### unscientific

I've discussed this problem with my supervisor, and I've realized I've gotten this all wrong! We know the following:

$$T_e (P_{local}, P_{probe}, w)$$
$$\frac{\partial T_e}{\partial P_{local}} (P_{local}, P_{probe}, w)$$

I'm supposed to do the following:

1. Find the contours of $T_e$ at the limit $P_{local} \rightarrow 0$ i.e. contours of$T_e (0, P_{probe}, w)$

2. Find the contours of $\frac{\partial T_e}{\partial P_{local}}$ at the limit $P_{local} \rightarrow 0$ i.e. contours of $\frac{\partial T_e}{\partial P_{local}}(0, P_{probe}, w)$

I'm really sorry about wasting your time with the earlier problem. I'm trying this new approach here:

1. Get mathematica to obtain expressions for $T_e (0, P_{probe}, w)$ and $\frac{\partial T_e}{\partial P_{local}}(0, P_{probe}, w)$ by rearranging and solving.

2. Plot the expressions.

Code (Text):

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];
y[Te_, w_] := (Abs[\[CapitalGamma][Te, w]])^2;
y[0.2, 10^9]

ContourPlot[y[Te, w], {Te, 0, 1}, {w, 0, 5*10^9}]
ContourPlot[
Te /. Reduce[Pprobe (1 - y[Te, w]) == (Te - Tb) Geb, Te], {w, 0,
5*10^9}, {Pprobe, 0, 10^-14}]

What's interesting is that I've managed to obtain a contour plot of $|\Gamma (w,T_e)|^2$:

So obviously now the only problem mathematica faces is to rearrange (reduce) the equation to obtain $T_e(w, P_{probe})$. I think once that's done, plotting it won't be a problem.

Last edited: Jul 10, 2014
10. Jul 10, 2014

### Bill Simpson

The whole point is to gently provide some hints to get a student to learn.

Now I think you have assumed something about the answer from Reduce which isn't true.

Try a simpler example and then figure out what to do.

Code (Text):
y /. Reduce[{3 x + 4 == y, 2 x - 4 == y}, {x, y}]
Hint: The answer isn't to not use Reduce.

11. Jul 10, 2014

### unscientific

That does nothing but give an error message. But when I use Solve instead:

Code (Text):
y /. Solve[{3 x + 4 == y, 2 x - 4 == y}, {x, y}]
It solves for $y$. It is very similar to my problem, just that there isn't a numerical solution to $y$. It will be a function of 2 other variables.

12. Jul 10, 2014

### Bill Simpson

Correct. But Solve is pretty much limited to polynomial problems. For many more complicated problems Solve will not be able to find an answer. Verify that for yourself.

Actually, for your problem with Abs and squares and complex numbers it may be questionable whether even Reduce will be able to find an answer.

But at least understanding the difference between the way Solve and Reduce return results will keep you from waiting a very long time and getting nothing but an error. You can also look into ToRules[Reduce[stuff]] and see what that will do for you, again complicated problems mean you should use caution to make certain any results are able to be correctly used.

13. Jul 10, 2014

### unscientific

I've taken a look at that, but it doesn't seem to be very elaborate. Is there a solution to this problem then? I don't think this is one of those extremely complex equations either - just an equation with 3 variables to rearrange and plot.

14. Jul 10, 2014

### Bill Simpson

I don't know if there is a solution or not. Using Abs is often going to make it more difficult to find a solution. Sometimes using assumptions to tell Mathematica the domains or ranges of some of your variables can help it find a solution, but other times that seems to just slow it down.

If you think that is simple then just think a minute, pick up your chalk and write out the solution. I suspect that will be more more challenging than finding the derivative that was your previous problem.

15. Jul 11, 2014

### unscientific

I think it's hard to obtain an expression or solve it, so now I am exploring an iterative approach.

$$P_{local} + P_{probe}(1-|\Gamma|^2) = (T_e - T_b)G_{eb}$$

We differentiate implicitly with respect to $P_{local}$ to obtain:

$$1 - 2P_{probe}|\Gamma(w,T_e)| \frac{\partial |\Gamma|}{\partial P_{local}} = G_{eb} \frac{\partial T_e}{\partial P_{local}}$$

This of course assumes that $\frac{\partial P_{probe}}{\partial P_{local}} = \frac{\partial w}{\partial P_{local}} = 0$.

We take the limit $T_e \rightarrow 0.2$

1.Mathematica solves equation starting from $\frac{\partial T_e}{\partial P_{local}}(0,0)$, and plots the point.
2.Increase step, solving equation \frac{\partial T_e}{\partial P_{local}}(0,0.1) and \frac{\partial T_e}{\partial P_{local}}(0.1,0), and plots the point.

Is there a method for doing this? I solved a similar two variable problem using range-kutta methods.

In the meantime, I try to write the section of the code that solves the equation when $P_{probe} = 0$, analytically it is easy; $\frac{\partial T_e}{\partial P_{local}} = \frac{1}{G}$. But mathematica can't seem to even work this out.

Code (Text):

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];
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];
Solve[ eqn1 [0.2, 0, 1], D[Te, Plocal]]

Last edited: Jul 11, 2014
16. Jul 11, 2014

### Bill Simpson

Really helpful hint. I can't be certain, but if you are just doing in a single step what you are presenting here then it seems like you are throwing a whole mathematical concept at Mathematica, punching Go and wondering why it doesn't understand the concept and tell you the answer. It would be nice if Mathematica were the equivalent of a bright grad student who could do all you expect and more.

I think you will be far more productive and have less aggravation if you check things, step by step, to see whether Mathematica is keeping up with you. Then assemble those steps, one at a time, as you work towards your big goal.

Example, ask Mathematica to do a tiny part of the problem above that you can't understand why it isn't working, ask it to tell you what it thinks D[Te, Plocal] is.

Code (Text):
In[14]:= D[Te, Plocal]

Out[14]= 0
That is what Mathematica thinks you are asking it to do.

Then ask any reasonable first year college student what the derivative of some symbol is with respect to some apparently completely unrelated symbol. If the student has his head on he should reply with zero. Then you ask him to solve an equation for zero, not that you want to find where the expression is zero, but you want to find the value of zero given that expression. If the student has his head on he should reply this request is nonsense The current state of Mathematica isn't even polite or smart enough to print a brilliantly clear informative message telling you that trying to Solve an expression for the number zero, or even any constant, instead of for a variable that appears in the expression, is a silly thing to ask it to do. But if you throw everything at once at Mathematica you are very likely to not get correct results back, not at least until you have a thousand hours of intense study and practice at getting to think "the Mathematica way." Even with probably ten times that experience I am still surprised when I think I know how to do something and get something clearly wrong back, let alone things that are subtly wrong and I could easily assume they were correct if I weren't vigilant.

Mathematica is a mix. It can do some things in a fraction of a second or a minute that nobody would be able to do by hand in minutes or a week. And there are many many things which exposes the lack of "mathematical maturity", the common sense developed by half a decade or a decade of being trained in the field of mathematics, and that doesn't even consider the problem of translating from the stuff in your head into the language Mathematica accepts.

Last edited: Jul 11, 2014
17. Jul 14, 2014

### unscientific

I tried the brute force approach, and something came out. I differentiated and found an expression$\frac{\partial |\Gamma|^2}{P_{local}}$ in terms of $(T_e, w,\frac{\partial T_e}{P_{local}} )$ by hand.

Letting the $\frac{\partial T_e}{P_{local}}$ be 'k' in my code, I solved the equation for the value of $k$ around $10^{13}$ and plotted the contour curve by substituting in values of $T_e$.

Code (Text):

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];
y[Te_, w_] := (Abs[\[CapitalGamma][Te, w]])^2;
y[0.2, 10^9]

R (1/((1/
R)^2 + (w*C1 - 1/(w*L[Te]))^2)   )  )^2 + ( (1/((1/
R)^2 + (w*C1 - 1/(w*L[Te]))^2)) (w*C1 - 1/(w*L[Te])) + 1/(
w*C2)  )^2;

x = (( 1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) -
Z0  )^2 + ((1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) (w*C1 - 1/(
w*L[Te])) + 1/(
w*C2))^2)/((1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) +
Z0)^2 + ((1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) (w*C1 - 1/(
w*L[Te])) + 1/(w*C2))^2);

A1[w_, Te_] := (1/((1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) +
Z0)^2 + ((1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) (w*C1 - 1/(
w*L[Te])) + 1/(w*C2))^2))^2

A2[w_, Te_, k_] :=
2 ( 1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) - Z0  ) (1/
R) ((-2) (w*C1 - 1/(w*L[Te])) (1/(
w*(L[Te])^2)) (10^-9*k))/((1/
R)^2 + (w*C1 - 1/(
w*L[Te]))^2)^2 + (2) ( (w*C1 - 1/(
w*L[Te])) (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) + 1/(
w*C2)) ( (1/(
w*(L[Te])^2)) (10^-9*
k) (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2))  +   (w*C1 - 1/(
w*L[Te])) (((-2) (w*C1 - 1/(w*L[Te])) (1/(
w*(L[Te])^2)) (10^-9*k))/((1/
R)^2 + (w*C1 - 1/(w*L[Te]))^2)^2) )

A3[w_, Te_] := ((1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) +
Z0)^2 + ((1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) (w*C1 - 1/(
w*L[Te])) + 1/(w*C2))^2)

A4[w_, Te_, k_] :=
2 ( 1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) + Z0  ) (1/
R) ((-2) (w*C1 - 1/(w*L[Te])) (1/(
w*(L[Te])^2)) (10^-9*k))/((1/
R)^2 + (w*C1 - 1/(
w*L[Te]))^2)^2 + (2) ( (w*C1 - 1/(
w*L[Te])) (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) + 1/(
w*C2)) ( (1/(
w*(L[Te])^2)) (10^-9*
k) (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2))  +   (w*C1 - 1/(
w*L[Te])) (((-2) (w*C1 - 1/(w*L[Te])) (1/(
w*(L[Te])^2)) (10^-9*k))/((1/
R)^2 + (w*C1 - 1/(w*L[Te]))^2)^2) )

A5[w_, Te_] := ((
1/R (1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)   ) -
Z0  )^2 + ((1/((1/R)^2 + (w*C1 - 1/(w*L[Te]))^2)) (w*C1 - 1/(
w*L[Te])) + 1/(w*C2))^2)

G[w_, Te_, k_] :=
A1[w, Te]*(A2[w, Te, k]*A3[w, Te] - A4[w, Te, k]*A5[w, Te])

eqn1[w_, Te_, k_, Plocal_] := 1 - 2*Plocal*G[w, Te, k]  ==  Geb*k
eqn2 = eqn1[w, 0.2, k, Plocal]

ContourPlot[
k /. FindRoot[eqn1[w, 0.2, k, Plocal], {k, 10^13}], {w, 2.5*10^9,
3.5*10^9}, {Plocal, 1*10^-16, 10^-14}, PlotRange -> All   ]

ContourPlot[y[Te, w], {Te, 0, 1}, {w, 0, 5*10^9},
FrameLabel -> {"\!$$\*SubscriptBox[\(w$$, $$probe$$]\)",
"\!$$\*SubscriptBox[\(T$$, $$e$$]\)"}];
ContourPlot[1 - y[Te, w], {Te, 0, 1}, {w, 0, 5*10^9}, Axes -> True,
FrameLabel -> {"\!$$\*SubscriptBox[\(w$$, $$probe$$]\)",
"\!$$\*SubscriptBox[\(T$$, $$e$$]\)"}];

Last edited: Jul 14, 2014
18. Jul 16, 2014

### unscientific

Oh and the axes should be $P_{probe}$ against $w$ instead of $P_{local}$ against $w$

But then again, there's something wrong with the contour. Changing the value of $k = \frac{\partial T_e}{\partial P_{local}}$ does nothing at all to the contour. I'm not sure what's wrong as this ' brute force ' method should work.

19. Jul 18, 2014

### unscientific

It's alright, I found a way to do it! Thanks alot for your guidance, Bill.