Re: Manipulate function
- To: mathgroup at smc.vnet.net
- Subject: [mg100945] Re: Manipulate function
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Thu, 18 Jun 2009 20:44:44 -0400 (EDT)
- References: <h1cvbs$jif$1@smc.vnet.net>
Przemyslaw Swatek wrote:
> hi !
>
> I have some problem (Mathematica 6) - when I type
> Manipulate[Plot[If[x < 0, n Sin[x], Cos[x]], {x, -10, 10}], {n, 0, 1}]
> all is ok, but when i try:
>
> M[x_]:=If[x < 0, n Sin[x], Cos[x]], {x, -10, 10}] and then
>
> Manipulate[Plot[M[x], {x, -10, 10}], {n, 0, 1}] it doesn`t work - I
> cannot manipulate varible of n. Whay ?
>
You should n make a parameter of M like this:
M[n_, x_] := If[x < 0, n Sin[x], Cos[x]];
Manipulate[Plot[M[n, x], {x, -10, 10}], {n, 0, 1}]
--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de