# Plotting a multivalued function [closed]

So I have a function

A *Sech[A *(x - c t)]* Exp[i*[(c/2) *x + (A^2 - c^2/4)* t]]


And I want to plot it but I'm not sure how. How do I specify each variable and plot it?

Consider A = 2, C= 4 for this case. I'd like to plot it between -4,4

• Is it correct to assume that x and t are the variables and the rest are parameters? Is i a constant or the imaginary unit? Can you give the numerical values you want to assign to the various parameters? May 20, 2021 at 12:24
• x,t are indeed variables. Consider A = 2, C= 4 for this case. I'd like to plot it between -4,4 May 20, 2021 at 12:25
• Ok, thanks. Can you please add these details to the OP so other users can read the proper description of the problem? May 20, 2021 at 12:26
• How about A = 2; c = 4; ContourPlot[ Re[A*Sech[A*(x - c *t)]*Exp[I*((c/2)*x + (A^2 - c^2/4)*t)]], {x, -4, 4}, {t, -4, 4}]? May 20, 2021 at 12:33

So, first of all there are a couple of mistakes in the way you have written down the function. The proper way is given below:

fncn[x_, t_] :=
A*Sech[A*(x - c t)]*Exp[I ((c/2)*x + (A^2 - c^2/4)*t)] // ExpToTrig //
FullSimplify


You can ignore the ExpToTrig and FullSimplify and just check the differences in the square brackets and the parentheses.

Then we set up the constants

A = 2;
c = 4;


This is showing you the Real and Imaginary part of your function

{ContourPlot[Re@fncn[x, t], {x, -4, 4}, {t, -4, 4}, PlotPoints -> 50],
ContourPlot[Im@fncn[x, t], {x, -4, 4}, {t, -4, 4},
PlotRange -> {-4, 4}]}


And the following is giving you the absolute value of the function

Plot3D[Abs[fncn[x, t]], {x, -4, 4}, {t, -4, 4}]

• That's great, exactly what I was after :) May 20, 2021 at 13:53
• Glad I was able to help! May 20, 2021 at 13:57