1
$\begingroup$

When I run the code,

ClearAll["Global`*"]

G = 0.01;
β = 1;
ωc = 50;

integralgamma[ω_, τ_] :=  4 G ω Exp[-ω/ωc] ((1 - Cos[ω τ])/ω^(2)) Coth[β ω/2];

mem : γ[τ_?NumericQ] :=  
  mem = NIntegrate[integralgamma[ω, τ], {ω, 0, Infinity}, 
  MaxRecursion -> 15, PrecisionGoal -> 5, WorkingPrecision -> 15];

oldprob[nx_, ny_, nz_, τ_] := 1/2 (1 + nz^2 + Exp[-γ[τ] ]*(nx^2 + ny^2));

newprob[nx_, ny_, nz_, τ_] := 1/2 (1 + Sqrt[nz^2 + Exp[-γ[τ] ]^2 * (nx^2 + ny^2) ]);

Plot[
  {oldprob[1/Sqrt (2), 1/Sqrt (2), 0, τ], 
   newprob[1/Sqrt (2), 1/Sqrt (2), 0, τ]}, 
  {τ, 0, 2}, 
  PlotRange -> {0, 1}, MaxRecursion -> 10, WorkingPrecision -> 15],

I get the error:

NIntegrate::inumr: The integrand integralgamma has evaluated to non-numerical values for all sampling points in the region with boundaries {{∞, 0.}}.

What could be the issue?

$\endgroup$
  • 1
    $\begingroup$ Change in Plot code : Sqrt (2) to Sqrt[2] $\endgroup$ – Mariusz Iwaniuk Aug 12 '16 at 15:52
2
$\begingroup$

From Mathematica Documentation Center:

It is important to remember that all function arguments in the Wolfram Language are enclosed in square brackets, not parentheses. Parentheses in the Wolfram Language are used only to indicate the grouping of terms, and never to give function arguments.

ClearAll["Global`*"]

G = 0.01;
β = 1;
ωc = 50;

integralgamma[ω_, τ_] :=  4 G ω Exp[-ω/ωc] ((1 - Cos[ω τ])/ω^(2)) Coth[β ω/2];

mem : γ[τ_?NumericQ] :=  mem = NIntegrate[
  integralgamma[ω, τ], {ω, 0, Infinity}, 
   MaxRecursion -> 15, PrecisionGoal -> 5, WorkingPrecision -> 15];

oldprob[nx_, ny_, nz_, τ_] := 1/2 (1 + nz^2 + Exp[-γ[τ] ]*(nx^2 + ny^2));

newprob[nx_, ny_, nz_, τ_] := 1/2 (1 + Sqrt[nz^2 + Exp[-γ[τ] ]^2 * (nx^2 + ny^2) ]);

Plot[{oldprob[1/Sqrt[2], 1/Sqrt[2], 0, τ], 
 newprob[1/Sqrt[2], 1/Sqrt[2], 0, τ]}, {τ, 0, 2}, 
  PlotRange -> {0, 1}, MaxRecursion -> 10, WorkingPrecision -> 15]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.