0

How do I fix the following code:

A[z_] = B*z^2;
Manipulate[FindMinimum[A[z], {z, 1}], {B, 1, 10}]

In particular, what is the best way to force substitution of B in A[z] inside FindMinimum? Following How to | Evaluate Expressions inside Dynamic or Manipulate, I tried the following which failed:

Manipulate[FindMinimum[With[{B = B}, A[z]], {z, 1}], {B, 1, 10}]

The following works, but seems clunky:

Manipulate[FindMinimum[A[z] /. B -> C, {z, 1}], {C, 1, 10}]

Actually I want something like this, but simpler, without all the substitutions:

Manipulate[
 Table[FindMinimum[A[z] /. B -> C, {z, y}], {y, {1,2}}], {C, 1, 10}]
  • Linked topic should answer your question, let me know if you disagree. And welcome to Mathematica.Stackexchange :) – Kuba Aug 01 '18 at 15:28
  • f[x_, b_] := x^2 + b*x; xm[b_] := x /. Last[FindMinimum[f[x, b], {x, 1}]] ; Manipulate[xm[b], {b, 0, 10}] – Alex Trounev Aug 01 '18 at 15:43

0 Answers0