Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to relate or connect a setter bar with a set of equations to graph them.

y1[x_] := f'[list[[1]]]*{x - list[[1]]} + f[list[[1]]]
y2[x_] := f'[list[[2]]]*{x - list[[2]]} + f[list[[2]]]
y3[x_] := f'[list[[3]]]*{x - list[[3]]} + f[list[[3]]]
y4[x_] := f'[list[[4]]]*{x - list[[4]]} + f[list[[4]]]
y5[x_] := f'[list[[5]]]*{x - list[[5]]} + f[list[[5]]]

Manipulate[
  Plot[{f[x], y1[x], y2[x], y3[x], y4[x], y5[x]}, {x, -3, 3}, 
    PlotRange -> 10],
  {{aprox, y1, "Aproximation"}, {y1, y2, y3, y4, y5}, ControlType -> SetterBar}]
share|improve this question

1 Answer 1

 list = RandomReal[{-2, 2}, {5}]
 f[x_] := x^3;

 y1[x_] := f'[list[[1]]]*{x - list[[1]]} + f[list[[1]]]
 y2[x_] := f'[list[[2]]]*{x - list[[2]]} + f[list[[2]]]
 y3[x_] := f'[list[[3]]]*{x - list[[3]]} + f[list[[3]]]
 y4[x_] := f'[list[[4]]]*{x - list[[4]]} + f[list[[4]]]
 y5[x_] := f'[list[[5]]]*{x - list[[5]]} + f[list[[5]]]

 Manipulate[ Plot[{f[x], aprox[x]}, {x, -3, 3},  PlotRange -> 10], 
 {{aprox, y1, "Aproximation"}, {y1, y2, y3, y4, y5}, ControlType -> SetterBar}]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.