0
$\begingroup$

I'm trying to write a script that will dynamically update, except for one variable, say y in a block

Dynamic@F[x,y]

So that it doesn't get re-evaluated when I reopen the notebook.

$\endgroup$
3
  • 1
    $\begingroup$ Perhaps, the option TrackedSymbols $\endgroup$
    – LLlAMnYP
    Commented Apr 8, 2016 at 17:26
  • $\begingroup$ Good idea, but what if I have only one symbol and I'd like it to be untracked? In other words I'd like F to evaluate, but x not. $\endgroup$
    – Ranza
    Commented Apr 8, 2016 at 21:09
  • 1
    $\begingroup$ then you still use Dynamic[F[x, y], TrackedSymbols :> {F}] and now only changes in F trigger an update $\endgroup$ Commented Apr 8, 2016 at 23:37

1 Answer 1

1
$\begingroup$

You might want to describe the problem you are trying to solve in more detail, the comments indicate that people aren't sure about that. Here is what I think could be what you are after:

With[{x = x},Dynamic[f[x, y]]]

using With you can insert the current value of x into the Dynamic as a constant, so it will not change anymore. Whenever the definitions for y or f change, the Dynamic will fire using the value of x which it had at evaluation time of the above expression. There are several other techniques to achieve the same thing, but I think With is probably the easiest of these to understand...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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