1
$\begingroup$

I would like to plot these following parametrizations:

$$s(\theta)=\sigma+\lambda s_{\nu}(\theta),\quad s_{\nu}(\theta)=\theta\cot(\theta) + i\nu\theta,\quad \theta\in(-\pi,\pi)$$

For more details, please see: The accurate numerical inversion of Laplace Transform by A. Talbot. The parameters $\sigma$, $\lambda$, and $\nu$ are adjustable. The Talbot's contour should looks like these two: Pic1 Or pic2

My attempt:

σ := 1
λ := 1/2
ν := 1
s1 := θ*Cot (θ) + (I ν θ)
eqn := σ + (λ s1), Assumptions -> -Pi <= θ <= Pi
ParametricPlot[{Re[eqn], Im[eqn]}, {f, -5, 2}, AspectRatio -> 1]

Sorry, I can't give further attempt since I'm not really familiar with Mathematica. Hope you can help me. Thanks in advance.

$\endgroup$
1
  • 1
    $\begingroup$ 1. Use Set (=) instead of SetDelayed (:=) for assignments to constants. 2) Assumptions is an option of only certain functions. You can't use it that way. Didn't you see the error when you tried to execute your code? 3) Functions in MMA enclose their parameters in [], so Cot[theta] and not Cot(theta). 4) The variable in ParametricPlot should be the same as in your equation, i.e. theta, not f. $\endgroup$
    – MarcoB
    Commented Feb 23, 2021 at 15:13

2 Answers 2

4
$\begingroup$

Start from here:

σ = 1;
λ = 1/2;
ν = 1;
s1 = θ Cot[θ] + I ν θ;
eqn = σ + (λ s1);
ParametricPlot[{Re[eqn], Im[eqn]}, {θ, -3.5, 3.5}, AspectRatio -> 1]

plot from code above

$\endgroup$
2
  • $\begingroup$ Wonderful. Thank you for your help!! $\endgroup$
    – user516076
    Commented Feb 23, 2021 at 15:20
  • $\begingroup$ In the current version, I would use ReIm[eqn] within ParametricPlot[]. $\endgroup$ Commented Feb 23, 2021 at 21:35
2
$\begingroup$

Some bells and whistles.

Clear["Global`*"]

Since the "parameters ... are adjustable" use Manipulate.

Manipulate[
 Module[{s1, θ, eqn},
  s1 = θ*Cot[θ] + I*ν*θ;
  eqn = σ + (λ*s1);
  ParametricPlot[
   {Re[eqn], Im[eqn]},
   {θ, -Pi, Pi},
   PlotRange -> {{-5, 3.5}, {-4.25, 4.25}},
   AspectRatio -> 1]],
 {{σ, 1}, 0, 2, 0.01, Appearance -> "Labeled"},
 {{λ, 0.5}, 0, 2, 0.01, Appearance -> "Labeled"},
 {{ν, 1}, 0, 2, 0.01, Appearance -> "Labeled"}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks. Another wonderful solution. By the way what does Clear[Global'*"] do? $\endgroup$
    – user516076
    Commented Feb 23, 2021 at 21:20
  • 1
    $\begingroup$ It removes any prior definitions that might potentially interfere with the code, i.e., makes sure you are starting with a clean slate. $\endgroup$
    – Bob Hanlon
    Commented Feb 23, 2021 at 21:23

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.