Message Boards Message Boards

0
|
6643 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Use of Manipulate with user defined function?

Posted 8 years ago

Dear community, I am having some trouble with a probably a stupid problem, I looked carefully in the documentation but I did not be able to find a solution. The problem is very easy to explain, if I define a function, for example:

f[x]:=a x.

Now, if I try using the Manipulate function in this way:

Manipulate[Plot[f[x],{x,0,3}],{a,0,1}],

the program shows me the Manipulate's box, but without the drawing of the function! But if I type:

 Manipulate[Plot[a x,{x,0,3}],{a,0,1}]

it works fine. Obviously either the Plot function and the line that I used are just an example, Mathematica does not work with any function. So, do I am making some error with the Mathematica syntax or does not Manipulate support the user defined functions? Thanks you for the answer

POSTED BY: Alessio Lapolla
3 Replies

It's my pleasure!

Thanks you very much

POSTED BY: Alessio Lapolla
f[a_, x_] := a x
Manipulate[Plot[f[a, x], {x, 0, 3}], {a, 0, 1}]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract