Ask Your Question
2

manipulation of parameter in a plot 2d function

asked 2017-03-22 12:42:45 +0100

psp gravatar image

In Mathematica is possible to plot a function of variables and parameters, giving the possibility to have a slider to change interactively the parameter values. For example this input Manipulate[Plot[1-a/x, {x, 0, 10}], {a, 0, 20}] outputs the plot of the function 1-a/x, where x is the variable, so values are on the x-axis, and a is a parameter and it's exact value is set on a slide bar, between 0 and 20, that appears with running. I tried to do that with Sage, using the @interact possibility but I cannot find a solution for that. Could someone help me?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-03-22 15:55:23 +0100

kcrisman gravatar image

Is this @interact not what you were looking for?

@interact
def _(a=slider([0..20],default=2)):
    plot(1-a/x, (x, 0, 10)).show(figsize=3,ymin=-10)
edit flag offensive delete link more

Comments

Great! Sorry, I've not found it before.

psp gravatar imagepsp ( 2017-03-23 13:06:37 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-22 12:42:45 +0100

Seen: 1,376 times

Last updated: Mar 22 '17