Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the Manipulate funvtion in Mathematica:

How is it possible to extend the scope of the slider variable beyong the 'Manipulate' function? In this coding 'n' = 10 before and after the 'Manipulate' function but can vary between -10 and +10 in the plot routine.

n = 10;
Manipulate[
   Plot[Sin[n*x], {x, -5, 5}], {n, -10, 10, 1, Appearance -> "Labeled"}]
   Print["n = ", n]   

Thank you in advance for all contributors. Norman

like image 938
Normanicus Avatar asked Feb 11 '26 22:02

Normanicus


1 Answers

Use another variable name for the control variable in the Manipulate.

n = 10;
Manipulate[
 Plot[Sin[(n = m)*x], {x, -5, 5}], {{m, n}, -10, 10, 1, Appearance -> "Labeled"}]
Print["n = ", Dynamic[n]]
like image 200
Chris Degnen Avatar answered Feb 16 '26 08:02

Chris Degnen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!