2

I have a function, say

minimizeme[ω_][β_][ϵ_] = ϵ^2 ω-Log[2 (Cosh[2 β]+Cosh[2 β ϵ])]/(2 β);

I want to make a high-precision dynamic ContourPlot of it using:

plottricrit[ω_] := ContourPlot[
 D[minimizeme[ω][β][ϵ], ϵ] == 0,
 {β, 0.5, 1.0},
 {ϵ, -3, 3},
 Evaluated -> True, 
 ContourStyle -> Thick, 
 RegionFunction -> Function[
    {β, ϵ}, 
    minimizeme[ω][β][ϵ] < minimizeme[ω][β][0]],
 ImageSize -> Large, 
 PerformanceGoal -> Accuracy,
 WorkingPrecision -> 60]

Manipulate[plottricrit[ω],{ω,0.217`60,0.22545`60}]

However, I keep running into a ContourPlot::precw message which tells me that

The precision of the argument function (...) is less than WorkingPrecision.

I have tried several ways to set the right precision (i.e., using With to inject a higher $MachinePrecision, using SetPrecision, using Rationalize, etc.), but I can't seem to get rid of this error. What is the right way to deal with it?

1 Answers1

5

New method

I found that using a step value that is arbitrary precision also works:

Manipulate[plottricrit[ω], {ω, 0.217`60, 0.22545`60, 1`60*^-6}]

Old method

For reference this was my original answer, which also works but is less clean:

plottricrit[ω0_] := With[{ω = SetPrecision[ω0, 100]},
   ContourPlot[D[minimizeme[ω][β][ϵ], ϵ] == 0, {β, 0.5, 1.},
   {ϵ, -3, 3}, Evaluated -> True, ContourStyle -> Thick,
   RegionFunction -> Function[{β, ϵ}, minimizeme[ω][β][ϵ] < minimizeme[ω][β][0]],
   ImageSize -> Large, PerformanceGoal -> Accuracy, WorkingPrecision -> 60]
 ]
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
  • Won't SetPrecision get me "virtual" precision? – Editortoise-Composerpent Jul 24 '12 at 14:28
  • 2
    @Andrea I'm sorry, I didn't read your question well enough; I was too busy editing in the Greek letters (I do wish there was a simple way to do that automatically). Yes, this would be "fake" precision, but given that it is originating from a slider I don't see why that matters. What am I missing? – Mr.Wizard Jul 24 '12 at 14:30
  • Yeah, you are right. I hadn't thought about that. Since it is an input value, it is only as good as I can input it, and as it stands I can still use higher precision numbers via the input field under the slider if needed. Thanks! So, basically, there is no way to tell the Manipulate function to feed higher-precision numbers to its arguments "internally". Is this right? – Editortoise-Composerpent Jul 24 '12 at 14:46
  • @Mr.Wizard a nice palette for conversion? – Dr. belisarius Jul 24 '12 at 19:11
  • @Mr.Wizard I usually hate questions with non ascii symbols. Makes more difficult to work with the answers. I am thinking of a palette that when some text is selected and a button pressed changes all greek symbols into something ascii – Dr. belisarius Jul 25 '12 at 03:54
  • @belisarius wait, are you saying you would rather have \[Beta] than β? I'm trying to go the other way. I could do it with a long replacement rule in a text editor but I'd rather have a "bookmarklet" or something like that, but I don't know how to write one. – Mr.Wizard Jul 25 '12 at 03:57
  • @Mr.Wizard No, I am saying that I would rather prefer to have b1 instead of β (just to answer questions not to perform real work, of course) – Dr. belisarius Jul 25 '12 at 04:01
  • @belisarius Okay. Why? – Mr.Wizard Jul 25 '12 at 04:02
  • @Mr.Wizard Just because many new users get tangled into \[Beta] when posting code or comments. And I hate illegible code – Dr. belisarius Jul 25 '12 at 04:04
  • Off topic but related to my comment: Is there a way to escape the backticks such that they don't break the inline code formatting? – sebhofer Jul 15 '13 at 11:15
  • @sebhofer use multiple backticks in a row to escape. Here is a test: one tick, two`ticks, three``ticks -- I'll take a look at the precision thing tomorrow. – Mr.Wizard Jul 15 '13 at 11:18
  • Oohh... great, thanks! – sebhofer Jul 15 '13 at 11:31
  • I just found out, that if the boundaries of the interval are given as integer numbers, you have to specify the precision explicitly. Try for example Manipulate[Precision/@{x,y,{{x,2},0`32,10`32,1`32},{{y, 2},0,10,1`32}]. (That's V.9 btw.) I think that is worth mentioning... – sebhofer Jul 15 '13 at 11:32