0

I'm trying to solve a simultaneous equations for $n$ and $k$. These 2 are functions of $w$. Then, I'd like to plot these functions dependent of $w$, but the plot shows nothing. Here is my code:

w0 = 10^16;
l = 10^14;
e0 = 1;
m = 0.02;
N1 = 10^28;
B = (w0^2 - w^2)^2 - l^2 w^2;
A = (N1 E^2)/ m e0;
sol = Solve[{n^2 - k^2 == 1 + A (w0^2 - w^2)/B, 2 n k == A l w/B}, {n,
 k}];
Plot[Evaluate[n[w] /. sol], {w, 10^15, 10^17}, PlotRange -> All]

Also after I evaluate sol I get the error below:

"Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result."

I'm really stuck, would appreciate your help.

saeedeh
  • 3
  • 2

2 Answers2

1

I'm not sure why you feel you need to incorporate n[w] in Plot. The solutions given for n are already expressed in terms of w.

If you simply evaluate Plot[Evaluate[n /. sol], {w, 10^15, 10^17}, PlotRange -> All] it produces

Blockquote

Also, evaluating Plot[k /. sol // Evaluate, {w, 10^15, 10^17}, PlotRange -> All] produces

Blockquote

As far as the Solve::ratnz message is concerned, it is not an error; please see this

user42582
  • 4,195
  • 1
  • 10
  • 31
1

Yo have two parameters to plot $n$ and $k$ as functions of $w$:

Plot[Evaluate[{n, k} /. sol], {w, 9.949 10^15, 9.951 10^15}, 
PlotRange -> All, Exclusions -> None, ExclusionsStyle -> Dashed, 
PlotPoints -> 40]

However, I suggest you rescale the frequency $w$ to avoid numerical problems when plotting.

enter image description here