Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with Manipulate

19 views
Skip to first unread message

Physics is Everything....Almost

unread,
May 18, 2012, 5:30:26 AM5/18/12
to

Why does Manipulate[ Plot[Sin[x (1+ a x)], {x,0,6} ], (a,0,2} ] work....
BUT..... the following doesn't....
tmp = Plot[Sin[x (1+ a x)], {x,0,6} ]
Manipulate[ tmp , (a,0,2}]
I checked Attributes of Manipulate and saw HoldAll......but Hold what??
thanks.....Jerry Blimbaum

djmpark

unread,
May 19, 2012, 5:46:05 AM5/19/12
to
How about:

ClearAll[tmp];
tmp[a_] := Plot[Sin[x (1 + a x)], {x, 0, 6}, Frame -> True]
Manipulate[tmp[a], {a, 0, 2}]

?


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/index.html

Dushan Mitrovich

unread,
May 19, 2012, 5:49:08 AM5/19/12
to
Physics is Everything....Almost wrote:
> Why does Manipulate[ Plot[Sin[x (1+ a x)], {x,0,6} ], (a,0,2} ] work....
> BUT..... the following doesn't....
> tmp = Plot[Sin[x (1+ a x)], {x,0,6} ]
> Manipulate[ tmp , (a,0,2}]

The opening paren should be a brace .

Bob Hanlon

unread,
May 19, 2012, 5:43:31 AM5/19/12
to
It is caused by scoping. "Manipulate generates a DynamicModule
object, with the variables u, v, etc. specified as local. "

tmp := Plot[Sin[x (1 + a x)], {x, 0, 6}];

Manipulate[a = b; tmp, {b, 0, 2}]


Bob Hanlon


On Fri, May 18, 2012 at 5:27 AM, Physics is Everything....Almost
<fizz...@knology.net> wrote:
>
> Why does Manipulate[ Plot[Sin[x (1+ a x)], {x,0,6} ], (a,0,2} ] work....
> BUT..... the following doesn't....
> tmp = Plot[Sin[x (1+ a x)], {x,0,6} ]
> Manipulate[ tmp , (a,0,2}]

esetlzn

unread,
May 19, 2012, 5:51:11 AM5/19/12
to
�� 12-5-18 ����5:30, Physics is Everything....Almost �:
Hi, no definition of the "a" in the "tmp" results in the problem.
My solution is as below:

f[a_] := Plot[Sin[x (1 + a x)], {x, 0, 6}];
Manipulate[f[a], {a, 0, 2}]

enjoy!

--- Posted via news://freenews.netfront.net/ - Complaints to ne...@netfront.net ---

DC

unread,
May 19, 2012, 5:52:12 AM5/19/12
to
Try :

tmp[a_] := Plot[Sin[x (1 + a x)], {x, 0, 6}];
Manipulate[tmp[a], {a, 0, 2}]

Peter Breitfeld

unread,
May 20, 2012, 2:35:26 AM5/20/12
to
Manipulate doesn't know, that tmp is dependend on a. So write instead:

tmp[a_] := Plot[Sin[x (1 + a x)], {x, 0, 6}]
Manipulate[tmp[a], {a, 0, 2}]

--
_________________________________________________________________
Peter Breitfeld | Bad Saulgau, Germany | http://www.pBreitfeld.de

0 new messages