« first day (165 days earlier)      last day (4316 days later) » 
00:00 - 20:0020:00 - 00:00

8:00 PM
returns {"RuntimeTools`Profile"}
 
@belisarius, so when you use it, in debug mode, it returns that error?
 
not sure if the current state of my kernel session is clean. Wait
Rebooted
Calls Time Evaluation
1 0.922 Table[f[x],{100000}];
1 0.922 Table[f[x],{100000}]
100000 0.688 f[x]
100000 0.502 f[x_]
200000 0.172 x^2
ha
 
Great
now the big question
 
quick!
 
Is it possible that most people don't know about it and wish they did?
 
8:02 PM
ha
 
acl
@Rojo an excellent question :)
thanks for letting us know that
 
z[x_, y_] :=
Exp[Sin[60*x]] + Sin[50*Exp[y]] + Sin[80*Sin[x]] + Sin[Sin[70*y]] -
Sin[10.0*(x + y)] + (x*x + y*y)/4;
dx = 0.0025; xg = 0; yg = 0;
min = z[SetAccuracy[-1, 20], SetAccuracy[-1, 20]];
For[xg = -1, xg < 1, xg = xg + dx;
For[yg = -1, yg < 1, yg = yg + dx;
If[ z[SetAccuracy[xg, 20], SetAccuracy[yg, 20]] < min,
min = z[SetAccuracy[xg, 20], SetAccuracy[yg, 20]] ]]]
 
I think it could make a nice blog post
 
But it's too short
I'll do my first self question-answer
 
Post it with lots of graphics
brb
 
8:04 PM
@acl Acl, I looked over you answer, greatly appreciated, Though it kills my machine !!!!!
 
acl
@Rojo oh, I just asked the question to get you to answer it.
I could delete it
@newprint really? it's effectively instantaneous here. or do you mean your real code?
also, do you see what is going on, or should I try to explain?
 
@acl oh
I just posted it too!
 
acl
@Rojo hang on, I'll get rid of mine
done. I've added the tag
so that people interested in the workbench will see that :)
 
@acl I have Lenovo X61 with 4 gigs of ram. That thing is dinosaur !!!!! Here is what I am trying to do. I want to find within the interval -1<x<1, -1<y<1 with step dx=0.0025 the minimum value of z.
In other words
subdivide -1<x<1, -1<y<1 into small squares of 0.0025 per side
and find within one of the squares what will the min be and x & y that give me this min
code above just kills my machine....... I left for 10 minutes, and it was still running !!!!!
 
acl
I see, it is also slow here
let me profile it with @Rojo's trick :)
 
8:13 PM
Ok, @newprint, sorry for going adrift
 
NP, have a good one
 
@newprint, so you want to evaluate z in a grid from -1 to 1 for x and y with dx=dy=0.0025 and find the minimum position?
 
@Rojo Where z takes the min value, and x & y where is minimum
I was told
 
@newprint. So, value and position of the minimum. And that issue with SetAccuracy, why are you doing that?
 
that somewhere -3<z<-4 should be a min
 
8:24 PM
Does anyone know something TemplateBoxOptions?
 
I konw "something"
 
Well, what do you know about it?
I don't see anything in the documentation
but I do see it being used in the Core.nb stylesheet
I was wondering, Why/How/When do you use it?
They have this in `Core.nb` for instance: `Cell[StyleData["Abs"],
TemplateBoxOptions->{DisplayFunction->(RowBox[{"\[LeftBracketingBar]", #, "\[RightBracketingBar]"}]& ),
Tooltip->Automatic}]`
 
There's some presentation in library.wolfram... that explains a little about it
The idea of a TemplateBox is
to have a box which displays as parametized in the stylesheet
so, for example
run this
 
acl
@newprint do you know what the correct answer is?
 
RawBoxes@TemplateBox[{2, 6}, "Binomial"]
 
8:27 PM
@Rojo Once I found the x,y,z at min, I am planning to change the dx to smaller resolution and dig even deeper
 
@Rojo, got it, :) Nice, now I see how to use the style abs... RawBoxes@TemplateBox[{3}, "Abs"]
 
@jmlopez
 
Ok, so it defines that...but, where else can you use this?
@Rojo, do they make use of these things in say, the palettes?
 
So, you just go to the "Abs" or "Binomial" style definition (or your own) and go check for the DisplayFunction in the TemplateBoxOptions
@jmlopez, it's more or less new but it's used plenty I think
It's very practical
 
Very practical indeed... Anyway, thanks @Rojo.
 
8:30 PM
No prob
 
Oh, @Rojo, where in the library do you find this information?
 
@newprint why do you not just use:
z[x_, y_] :=
  Exp[Sin[60*x]] + Sin[50*Exp[y]] + Sin[80*Sin[x]] + Sin[Sin[70*y]] -
   Sin[10.0*(x + y)] + (x*x + y*y)/4;
NMinimize[{z[x, y], -1 < x < 1, -1 < y < 1}, {x, y},
 Method -> {"DifferentialEvolution",
   "CrossProbability" -> 0.05,
   "PostProcess" -> {FindMinimum, Method -> "QuasiNewton"}
   }
 ]
 
Alright...got more reading material, thanks again @Rojo.
 
@jmlopez, don't forget to let me know about anything you read or come up with your gut tells you it's interesting
:)
 
acl
8:33 PM
@newprint but why not use something like
step = .005;
AbsoluteTiming[
 tmp = Flatten[
    Table[{x, y, z[x, y]}, {x, -1, 1, step}, {y, -1, 1, step}],
    1
    ];
 ]

tmp\[LeftDoubleBracket]Ordering[
   tmp\[LeftDoubleBracket]All,
    3\[RightDoubleBracket]]\[LeftDoubleBracket]1\[RightDoubleBracket]\
\[RightDoubleBracket]
 
@newprint, the min in that grid is -3.25945 right
 
@newprint that gives {-3.260804657172493, {x -> -0.3405325639186554, y -> -0.7429354964052722}}, which I am pretty sure is the minimum in the unit square.
 
acl
@Rojo I see {-0.341, -0.743, -3.26002} here, for dx=dy=10^(-3)
@OleksandrR no doubt, but how are you sure?
 
@acl only "pretty sure". :) I've learned to trust differential evolution to get it right most of the time.
@newprint if you want that to 200 decimal places, you just have to set WorkingPrecision -> 200...
 
I am on the phone
will be back within 10 min
 
acl
8:40 PM
@OleksandrR indeed... I just did
out = Table[
   NMinimize[{z[x, y], -1 < x < 1, -1 < y < 1}, {x, y},
    Method \[Rule] {"DifferentialEvolution",
      "RandomSeed" \[Rule] i}],
   {i, 1, 30}
   ];
 
...but first make your function exact. Remove that Sin[10.0
 
acl
and Min@out\[LeftDoubleBracket]All, 1\[RightDoubleBracket] gives -3.2608
 
@OleksandrR, those you wrote aren't the default options, right?
Is it often important to tweak them?
If so what do you suggest as reading for someone that doesn't know the specific methods to get a grasp on which are best for each situation? The tutorials?
 
@Rojo "CrossProbability" is often important. In general differential evolution is quite sensitive to the parameter values. In my case I've read a lot of papers about differential evolution and written my own minimizer using it, so no, not the tutorials.
@Rojo the default value of "CrossProbability", i.e. 0.5, has actually been shown to be one of the worst possible initial choices. Larger or smaller values (near to 0 or 1) are generally more successful.
 
Could someone execute this: Nearest[DictionaryLookup[__]] ... it kills my kernel
 
R.M
8:50 PM
@belisarius hmm... not as bad as I thought. NearestFunction[{92518,1},<>]
instantaneous
f = Nearest[DictionaryLookup[__]];
f["foo"]
{"boo", "coo", "fob", "foe", "fog", "food", "fool", "foot", "fop", \
"for", "fox", "fro", "goo", "loo", "moo", "too", "woo", "zoo"}
 
@RM Hmm ... I can't run that
it kills my kernel
I'll reboot my machine brb
 
Okay, I'm out... back in a while (need to buy groceries).
 
By and thanks @OleksandrR
@belisarius, instant
 
9:05 PM
Sorry, I have was on the phone
@acl How effective your method at smaller step value ?
@OleksandrR I just set the WorkingPrecision -> 200, and here what I got "NMinimize::precw: The precision of the argument function (E^Sin[60 x]+1/4 (x^2+y^2)+Sin[50 E^y]-Sin[10. (x+y)]+Sin[80 Sin[x]]+Sin[Sin[70 y]]) is less than WorkingPrecision (200). >> "
 
9:52 PM
@newprint yes, indeed; the message is quite accurate. As Rojo pointed out, you have a MachinePrecision 10.0 in there. Change it to 10 (no decimal point) first.
@newprint in Mathematica, lower-precision numbers "poison" calculations. You need to avoid them if you want to work at high precision.
 
acl
@newprint it's doing the exact same thing as yours, just written in a different way.
In any case, you're evaluating z 160000 times. that's going to be the bottleneck with exact/high precision numerics
 
@Rojo in the case of differential evolution, it has the very convenient property of being able to optimize its own parameters (meta-optimization), if you have a problem similar to your real one but less computationally expensive. I have used that feature quite often.
 
@OleksandrR hold on, let me take a look one more time
 
@Rojo if you're interested in global optimization, I might suggest Thomas Weise's free book as a good starting point. It doesn't cover random search explicitly but that is basically a hill-climbing method.
 
In[5]:= z[x_, y_] :=
Exp[Sin[60*x]] + Sin[50*Exp[y]] + Sin[80*Sin[x]] + Sin[Sin[70*y]] -
Sin[10*(x + y)] + (x*x + y*y)/4;
NMinimize[{z[x, y], -1 < x < 1, -1 < y < 1}, {x, y},
WorkingPrecision -> 200,
Method -> {"DifferentialEvolution", "CrossProbability" -> 0.05,
"PostProcess" -> {FindMinimum, Method -> "QuasiNewton"}}]

Out[6]= {-2.\
9317785210845808590486642578114633966749159059747927897040324082990498\
3870862195980085592715738279663359946547207645891102974813100933466970\
04325602385436790609204478116476639483176699532964135380455, {x -> \
 
acl
10:00 PM
does anybody have any idea what this is about? (guess not, but...) It's started appearing in around half the startups today
sent to Support already
 
Blergh
 
Now compare with this result In[9]:= z[-0.34, -0.74]

Out[9]= -3.24516
In other words, WorkingPrecision->200 is making things worst
 
@newprint then change the Method to:
Method -> {"DifferentialEvolution",
  "CrossProbability" -> 0.05, "ScalingFactor" -> 0.8, "SearchPoints" -> 50,
  "PostProcess" -> {FindMinimum, Method -> "QuasiNewton"}}
 
Now we are rolling !!!!
Thanks a lot !!
I helps
 
10:18 PM
@newprint hmm, I just plotted this function. It's nastier than I thought. Definitely a good candidate for differential evolution.
 
@OleksandrR I have tried it with NelderMead method
and it is getting stuck right away in some local minimum
NMinimize[z[x, y], {x, y}, Method -> "NelderMead"]

{-1.27726, {x -> -1.07533, y -> -0.122678}}
 
@newprint yes, I'm not surprised. This function is a bit like the Rastrigin's function; it is quite deceptive.
 
10:34 PM
@newprint
Show[{
Plot3D[z[x, y], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 50],
Graphics3D[{Red, PointSize[0.05], Point[{{-0.34, -0.74, -3.26}}]}]
}]
 
10:51 PM
@OleksandrR hm,let me graph it
@OleksandrR I see the red point, but it is very hard to tell anything about minima from the 3D graph. I will attempt to graph it another way
 
@OleksandR, thanks for the book
 
@OleksandrR Ok, I tried to plot ShadowPlot3D with PlotPoints->35
 
Does anyone know how to abort the execution of something from within a dialog?
 
It crashed on me ((((
Alt+. ???
 
@newprint, run Dialog[] and then try that
I mean, to exit the dialog and abort
 
11:03 PM
Can't, just ran Dialog[] and tried Alt + .
 
@Rojo Return@Abort[] ?
 
@OleksandrR doesn't work as I intend
My problem is when I make a mistake and get Dialogs in a loop or something
so, as soon as I Return[], I am in a new one
but perhaps there's an idea there, let me try
 
Maybe the 2nd argument of Return, to return higher up the stack?
I've rarely used Dialog and never got into a loop of them, so I'm just guessing here.
 
That's an idea. I'm doing some tests. I almost never use it either because I tend to get in loops when I do :P Same goes for TraceDialog. If not loops, too many dialogs to return from
Ok
I got my way out
 
11:22 PM
@Rojo how did you manage it? Not Goto I hope? ;)
 
Haha, I hadn't even thought of that
It's a partial solution, for explicit usage of Dialog, but not for traceDialog
Instead of Dialog[], I insert Dialog[][], and then Return[Abort[]&]
to delay the execution of Abort
 
Ah, that's a neat trick.
 
OH
Idea
HAHA
IT WORKS
I love this language
 
@Rojo I know the feeling. I love it when you write something and think, "well, that'll never work, but why not try it anyway" and then it works perfectly as you intended!
What's the latest trick?
 
@OleksandrR, I'm trying to make it fit to return Abort, but
try running Module[{}, {Dialog[]; Dialog[]}; 3], for example
and now, you can exit both at once with
Return[Block[{Return}, Return[]]]
 
11:32 PM
Haha, yes. Actually I'd just been thinking about some trick with Block... a remarkably useful construct!
Oh, hang on... Return@Return[] also works. Seems like Block doesn't really do anything here.
 
@OleksandrR it does
Oh
It doesn't
Btw, instead of Dialog[][] and Return[Abort[]&], simpler to type Return[Abort]
GOT IT
@OleksandrR
 
ExitDialog@Unevaluated@Abort[]
 
Nice! An undocumented one there?
 
:)
 
11:51 PM
@Rojo BTW, good find with RuntimeTools`Profile too. That'll be very useful! As soon as I get more upvotes, you're getting the first for that. :)
 
@OleksandrR, I'm glad you don't have them yet, since I'm clipped for the day, for another 8 minutes
Hey @MrWizard
@OleksandrR, also, it wasn't a new find. I was reading the blog and saw that it was a wanted feature. I assumed it was more well known
 
@Rojo ah, okay. Well, I've not got Workbench so I never really played around with the debugger and all the related paraphernalia. But that is one thing that will definitely benefit me.
 
@acl Okay, it seems there is a consensus on this. Let me ask, do any you have a problem with me starting a personal blog, separate from StackExchange, and posting and commenting on questions and answers I find valuable? I cannot imaging this would upset anyone, but then I honestly did not imagine that my chat comments about "under appreciated" posts would either.
 
Uhh
I wanna know what you're talking about @MrWizard
 
00:00 - 20:0020:00 - 00:00

« first day (165 days earlier)      last day (4316 days later) »