# Getting errors when evaluating a Manipulate expression

My code

Manipulate[
Panel[Plot3D[
Re[H + Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*
Exp[I*(k*x - (Sqrt[9.81*H])*t)]],
{x, -80000, 80000}, {y, 0, 100000},
PlotPoints -> 30, MeshStyle -> None,
PlotStyle ->
Directive[Opacity[0.65], Blue, Specularity[LightBlue, 10]]]],
Panel[Dynamic[
StreamPlot[
{Sqrt[9.81/H]*
Re[Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*Exp[I*(k*x - ω*t)]], 0},
{x, -80000, 80000}, {y, 0, 100000}]]],
{{t, 0, "Time {s}"}, 0, 1000},
{{Amp, 20, "Wave Amplitude"}, 0, H},
{{k, 0, "Waves per Metre (x-direction)"}, 0, 0.0005},
{{H, 100, "Depth"}, 0, 500},
{{f, 0, "Coriolis Coefficient"}, -0.01, 0.01}]


I keep getting the error:

{2} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing

and

Lists {SystemProtoPlotDumpvectordataextremes$1118273, System ProtoPlotDumpvectorcolorfunction\$1118273} and !({\"Range\", \ \"ColorFunction\"} /. \"2\") are not the same shape.

I don't know what the problem is. I hope someone can help me identify the issue.

P.S. I am a relative beginner in Mathematica and am trying to plot a Kelvin Wave.

• Your code seems okay here. Have you tried restarting the kernel? – Simon Woods Jun 17 '17 at 12:10
• No, I still get the same problem. Have you tried it in your own Mathematica? Does an error come up? – Jelmes Jun 17 '17 at 12:30
• I tried it in Mathematica 11.1, it worked with no errors – Simon Woods Jun 17 '17 at 12:32
• And did you move the sliders, particulary that of the Coriolis Coefficient? – Jelmes Jun 17 '17 at 12:49
• Works fine here too. Try quitting Mathematica and trying again. – bill s Jun 17 '17 at 12:55

I did not get the error messages you report in your question when I evaluated your code on my system (V11.1.1 running on OS X 10.10.2). I did encounter some other problems. The following minor rewrite seems to work well.

Manipulate[
Column[{
Panel[
Plot3D[
Re[H + Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*Exp[I*(k*x - (Sqrt[9.81*H])*t)]],
{x, -80000, 80000}, {y, 0, 100000},
PlotPoints -> 30, MeshStyle -> None,
PlotStyle -> Directive[Opacity[0.65], Blue, Specularity[LightBlue, 10]]]],
Panel[
StreamPlot[
{Sqrt[9.81/H]*Re[Amp*Exp[-y*Abs[f]/Sqrt[9.81*H]]*
Exp[I*(k*x - Sqrt[9.81*H]*t)]], 0},
{x, -80000, 80000}, {y, 0,100000}]]}],
{{t, 0, "Time {s}"}, 0, 1000},
{{Amp, 20, "Wave Amplitude"}, 0, H},
{{k, 0, "Waves per Metre (x-direction)"}, 0, 0.0005},
{{H, 100, "Depth"}, 0, 500},
{{f, 0, "Coriolis Coefficient"}, -0.01, 0.01}]


Notes

1. I put the stream plot in the content pane with the 3D plot because I don't think you want to be treated as an annotation to the plot.
2. I give ω an arbitrary value because you didn't define it in your code.

### Edit

I have updated the code to use the relation ω = Sqrt[9.81*H]

• But the problem with this, is that $\omega$ is already defined by a formula (see code). If you fixed an arbitary value, it won't update the value. – Jelmes Jun 18 '17 at 13:42
• and I'm still getting the error message with your script when I change the values. Maybe as I am working on my laptop, maybe the computation is too heavy? – Jelmes Jun 18 '17 at 13:45
• @Jelmes. I repeat: there is no definition of ω in the code you posted. It's appearance in an expression is not a definition. If ω = Sqrt[9.81*H]), which it suggested by expression you use in your 3D plot, you must either substitute Sqrt[9.81*H]) for ω or make an explicit definition. – m_goldberg Jun 18 '17 at 16:27
• Ah yes, I noticed that. Would I put it at the start of the code before the manipulate, or inside? – Jelmes Jun 18 '17 at 16:37
• You noticed what? Is my conjecture that ω = Sqrt[9.81*H]) correct? Your last comment is mystifying. – m_goldberg Jun 18 '17 at 16:56