Group Abstract Group Abstract

Message Boards Message Boards

One question with Manipulate function

GROUPS:

Can anyone tell me how to define a function to produce a sum of n terms with a slider of each term ex. for 3 terms only Manipulate[Evaluate[Sum[Subscript[a, i], {i, 1, 3}]], {Subscript[a, 1], 0, 1}, {Subscript[a, 2], 0, 1}, {Subscript[a, 3], 0, 1}] This previous example is a model of the required function. I need to define a function of n terms This is my try f[n_] := Manipulate[Evaluate[Sum[Subscript[a, i], {i, 1, n}]], Table[{Subscript[a, i], 0, 1}, {i, 1, n}]]

but the problem in the Table function which will produce (for example n=3) {{Subscript[a, 1], 0, 1}, {Subscript[a, 2], 0, 1}, {Subscript[a, 3], 0, 1}} here the exact problem that the two successive brackets "{{" and, "}}" which should be only one bracket "{" and, "}" as shown in the attached notebook. So, please, anyone know how to overcome this problem inform me Thanks a lot

Attachments:
POSTED BY: Hosam Hefnawy
Answer
20 days ago

Something like this?

(* Mathematica 7 *)
f[x_] := 1 + 2 x + 3 x^2 + 4 x^4 (*Define the function*)

Manipulate[
Take[f[x], n](*Take n terms*)/. x -> m (*replacing x with some value m*), {n, 1, 4, 1}, {m, 1, 3, 1},
SaveDefinitions -> True,
ControlType -> RadioButton ]
POSTED BY: Isaac Abraham
Answer
20 days ago

After reading more carefully about the subscripted terms, something like the following?

(* Mathematica 7 *)
f[n_] := Sum[ Subscript[a, j], {j, 0, n}](*Define the function*)
Manipulate[ f[n], {n, 0, 4, 1}, ControlType -> RadioButton]
POSTED BY: Isaac Abraham
Answer
20 days ago

The problem is how to write a correct code for the second argument in Manipulate function as follows f[n_] := Manipulate[Evaluate[Sum[Subscript[a, i], {i, 1, n}]], ...........] i.e. what to be written in the space shown in the above function definition. in other words it is needed to define a function can generate the following set {Subscript[a, 1], 0, 1}, {Subscript[a, 2], 0, 1}, {Subscript[a, 3], 0, 1}.....{Subscript[a, 3], 0, 1} to be written in the Manipulate command

POSTED BY: Hosam Hefnawy
Answer
18 days ago