0
$\begingroup$

Question: Why do I get error messages such as "LessEqual::nord: Invalid comparison with 1. -1.59148 I attempted." when I try to plot the function f[z,k] defined below with for example the Plot invocation illustrated below?

f[z_, k_] := (
 I E^(-((2 I \[Pi])/k))
   HurwitzLerchPhi[E^(-((2 I \[Pi])/k)), 1, 1 + (I z)/(2 \[Pi])])/(
 2 \[Pi])

Plot[{Abs@f[s, 2]}, {s, -10, 10}, GridLines -> Automatic]
$\endgroup$
  • $\begingroup$ Cannot reproduce (10.4.1 for Microsoft Windows (64-bit)). $\endgroup$ – AccidentalFourierTransform Jun 20 '19 at 19:39
  • $\begingroup$ I get two of those errors with 12.0.0 with a fresh notebook. Simplify doesn't help, ComplexExpand doesn't help $\endgroup$ – Bill Jun 20 '19 at 19:53
  • $\begingroup$ Try adding the option Exclusions -> None. I'd say this is a (very minor) bug. The message should be turned off, while Plot is figuring out discontinuities. You should report it to WRI, imo. $\endgroup$ – Michael E2 Jun 20 '19 at 22:07
2
$\begingroup$

My best guess is that Plot is trying to do some fancy symbolic manipulation beforehand. I'm running V12.0.0 on macOS 10.14.5, and this worked for me, although make sure you use a fresh notebook or clear the definitions for f first.

f[z_?NumericQ, k_?NumericQ] := 
 Abs[(I E^(-((2 I \[Pi])/k)) HurwitzLerchPhi[E^(-((2 I \[Pi])/k)), 1, 
      1 + (I z)/(2 \[Pi])])/(2 \[Pi])]
Plot[f[s, 2], {s, -10, 10}]

This forces Mathematica to only evaluate f when it receives a numerical argument.

Plot of f when it only receives numerical arguements.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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