Ask Your Question
0

The interact gives the error message "TypeError: unsupported operand type(s) for *: 'DiscreteSlider' and 'sage.symbolic.expression.Expression'" when the slider is moved?

asked 2018-06-04 19:05:23 +0100

Ellis Shamash gravatar image

@interact def piecewise(fx = selector(values=["Two Pieces","Three Pieces"],label="Select Number of Pieces"),

base = slider(vmin=10,vmax=200,step_size=10,default=30,label = "Base Rate = "),

c1= slider(vmin=0.1,vmax=1,step_size=0.1,default=0.6,label="charge_per_unit_tier1 = "),

cd1=slider(vmin=100,vmax=1000,step_size=10,default=700,label="condition_tier1 = "),

c2 = slider(vmin=0.1,vmax=1,step_size=0.1,default=0.9,label="charge_per_unit_tier2 = ")):

f = piecewise( [ [(0,cd1),base+c1*x], [(cd1,1000),base+c1*cd1+c2*(x-cd1) ]] )
show(plot(f,(x,0,1000)),gridlines="minor")
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-04 19:27:04 +0100

Ellis Shamash gravatar image

I found my error. Sorry.

edit flag offensive delete link more

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: 2018-06-04 19:05:23 +0100

Seen: 266 times

Last updated: Jun 04 '18