1

I want to know why this error happens and how to fix this problem. The code is

mmu = 105.66*10^-3;
mW = 80.379;
Δamumax = (26.1 + 8.0)*10^-10;
Δamumin = (26.1 - 8.0)*10^-10;
e1[M44nu_] := M44nu/mmu; lambda1 = mmu/mW; 
yv1[M44nu_, tanβ_] := (246 tanβ)/(
Sqrt[2] M44nu Sqrt[1 + tanβ^2]) ; 
ya1[M44nu_, tanβ_] := (246 tanβ)/(
Sqrt[2] M44nu Sqrt[1 + tanβ^2]); 
P3pp[M44nu_, x_] := -2 x^2 (1 + x - 2 e1[M44nu]) + 
lambda1^2 x (1 - x) (1 - e1[M44nu])^2 (x + e1[M44nu]);
P3mm[M44nu_, x_] := -2 x^2 (1 + x + 2 e1[M44nu]) + 
lambda1^2 x (1 - x) (1 + e1[M44nu])^2 (x - e1[M44nu]);

Δaμ11[M44nu_, tanβ_] := -1/(8 π^2) mmu^2/ mW^2 NIntegrate[( Abs[yv1[M44nu, tanβ]]^2 P3pp[M44nu, x] + Abs[ya1[M44nu, tanβ]]^2 P3mm[M44nu, x])/( e1[M44nu]^2 lambda1^2 (1 - x) (1 - e1[M44nu]^-2 x) + x), {x, 0, 1}]

When I tested the function Δaμ11[M44nu_,tanβ_ with arbitrary values, it gave some numerical result back to me.

In[43]:= Δaμ11[1000, 100]

Out[43]= 9.6787*10^-10

In[44]:= Δaμ11[1000, 200]

Out[44]= 9.67942*10^-10

And then I tried to draw contour plot using the function, but it gave the error message as below.enter image description here

I would be very grateful if you can help me to solve this problem.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
lhcQFT
  • 117
  • 7

2 Answers2

2

Define the NIntegrate containing function variables as numeric variables with _?NumericQ in order to prevent NIntegrating working with symbols.

Δaμ11[M44nu_?NumericQ, 
 tanβ_?NumericQ] := 
  -1/(8 π^2) mmu^2/
  mW^2 NIntegrate[(Abs[yv1[M44nu, tanβ]]^2 P3pp[M44nu, x] + 
  Abs[ya1[M44nu, tanβ]]^2 P3mm[M44nu, 
    x])/(e1[M44nu]^2 lambda1^2 (1 - x) (1 - e1[M44nu]^-2 x) + 
  x), {x, 0, 1}]

ContourPlot[{Δaμ11[M44nu,tanβ] == Δamumax, Δaμ11[ M44nu, tanβ] == Δamumin}, {M44nu, 1, 10^3}, {tanβ, 0, 50}, PlotPoints -> 30, ContourStyle -> {Red, Blue}]

enter image description here

Akku14
  • 17,287
  • 14
  • 32
1
Clear["Global`*"]

mmu = 105.66*10^-3 // Rationalize;
mW = 80.379 // Rationalize;
Δamumax = (26.1 + 8.0)*10^-10 // Rationalize[#, 0] &;
Δamumin = (26.1 - 8.0)*10^-10 // Rationalize[#, 0] &;
e1[M44nu_] := M44nu/mmu;
lambda1 = mmu/mW;
yv1[M44nu_, 
   tanβ_] := (246 tanβ)/(Sqrt[2] M44nu Sqrt[1 + tanβ^2]);
ya1[M44nu_, 
   tanβ_] := (246 tanβ)/(Sqrt[2] M44nu Sqrt[1 + tanβ^2]);
P3pp[M44nu_, x_] = -2 x^2 (1 + x - 2 e1[M44nu]) +
    lambda1^2 x (1 - x) (1 - e1[M44nu])^2 (x + e1[M44nu]) // Simplify;
P3mm[M44nu_, x_] = -2 x^2 (1 + x + 2 e1[M44nu]) +
    lambda1^2 x (1 - x) (1 + e1[M44nu])^2 (x - e1[M44nu]) // Simplify;

f[M44nu_, tanβ_, x_] = (Abs[yv1[M44nu, tanβ]]^2 P3pp[M44nu, x] +
      Abs[ya1[M44nu, tanβ]]^2 P3mm[M44nu, x])/
    (e1[M44nu]^2 lambda1^2 (1 - x) (1 - e1[M44nu]^-2 x) + x) // Simplify;

For functions that use numeric techniques (e.g., NIntegrate), the function's arguments should be restricted to numeric values.

Δaμ11[M44nu_?NumericQ, tanβ_?NumericQ] :=
 Module[{
   M44nuP = SetPrecision[M44nu, 20],
   tanβP = SetPrecision[tanβ, 20]},
  -1/(8 π^2) mmu^2/mW^2 NIntegrate[f[M44nuP, tanβP, x], {x, 0, 1},
    WorkingPrecision -> 20]]

ContourPlot[{
   Δaμ11[M44nu, tanβ] == Δamumax,
   Δaμ11[M44nu, tanβ] == Δamumin},
  {M44nu, 4*^2, 10^3}, {tanβ, 1, 50},
  WorkingPrecision -> 15,
  PlotPoints -> 50,
  MaxRecursion -> 2,
  PlotLegends -> {
    "Δaμ11[ ]=Δamumax",
    "Δaμ11[ ]=Δamumin"}] // Quiet

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198