Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to do some optimization based on interactive parameters, then compute and present stuff based on the optimized results. In trying to do that, I came across some strange behavior I can't figure out.

When I write either:

Manipulator[Dynamic[y], {0, 1}]
Dynamic[NMinimize[(z - y)^2, z]]

or even:

  Manipulator[Dynamic[y], {0, 1}]
  Dynamic[NMinimize[(z - y)^2, z]]

it runs incredibly slower than:

  NMinimize[(q - p)^2, q]
, {p, 0, 1}]    

The first two are much, much slower, to the point they slow down my whole session, and I can't figure out why. Any ideas on how to speed it up?

share|improve this question

closed as off-topic by Kuba, Jens, Michael E2, bobthechemist, m_goldberg Nov 17 at 3:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba, Jens, Michael E2, bobthechemist, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

With the simplistic examples given I don't notice anything being particularly slow. What version are you using? Could you give a more representative example? –  Mr.Wizard Aug 2 at 23:48
Michael, thanks for spotting that typo, but either function is slower, so it makes no difference for me. –  imh Aug 3 at 17:11
Mr.Wizard, I'm using It doesn't make things crazy slow, but (at least on my machine, a 4 year old macbook air) if you try typing while the Dynamic expression is running, there's a noticibly slower response. I'll put together a more representative example that isn't a hundred lines tonight. Thanks –  imh Aug 3 at 17:13
BTW, you need to put a @ in front of our names (e.g. @MichaelE2) for us to be notified of your response. The author of a question or answer always gets notified even without the @name. (I just happened to see the question come to the top of the stack and took a look.) –  Michael E2 Aug 3 at 17:31
I can't reproduce this either. –  Pickett Aug 5 at 21:03