Message Boards Message Boards

Avoid warning without disabling it for this plot?

GROUPS:

Hi, I am using this line to plot a magnetic field :

ReplaceAll[
 crossSectionFieldPlot["\[ScriptCapitalH]", 
  nqvrbmmf[mm0, a, b, c, x, 0, z][[{1, 3}]] ], {mm0 -> 10^6, 
  a -> 0.01, b -> 0.01, c -> 0.01}] 

crossSectionFieldPlot is from the blog of Michael Trott with a small modification. The plot is created at the end, but I am getting a bunch of warnings before, because Mathematica tries to use the a, b, c parameters of nqvrbmmf in crossSectionFieldPlot without doing the numerical replacements first. I tried also this form:

crossSectionFieldPlot["\[ScriptCapitalH]", 
  nqvrbmmf[mm0, a, b, c, x, 0, z][[{1, 3}]] ] // 
 ReplaceAll[#, {mm0 -> 10^6, a -> 0.01, b -> 0.01, c -> 0.01}] &

but the warnings are still there. So the real question is, how to make the substitutions with ReplaceAll for the parameters of nqvrbmmf BEFORE the evaluation of crossSectionFieldPlot ? I also tried a few combinations of Hold and ReleaseHold here and there with no cigar. Thanks ahead, János

POSTED BY: Janos Lobb
Answer
8 days ago

Please consider to supply a bit more context

  • which blog post of Mr Trott do you refer to
  • which warnings do you see ...

to get a better answer. Quite often this helps

  • an educated use of Evaluate[]
  • redefining a function from f[x_, y_, z_, ...] into f[x_?NumericQ, y_?NumericQ, z_?NumericQ, ...] as far as it is sure that $x, y, z$ are intended to be numrical: NumericQ
POSTED BY: Udo Krause
Answer
8 days ago

Group Abstract Group Abstract