Interactive: Differentiating Practice (random polynomials)

558 days ago by lhjruo

Interactive application for practicing differentiating randomly generated polynomials

Lauri Ruotsalainen, 2010

Picture:


# Interactive application for practicing differentiating randomly generated polynomials # Lauri Ruotsalainen, 2010 R.<x> = ZZ[] function = R.random_element(3, -10,10) new_ex_state = True solution_state = True @interact def deriv_practice1(answer = input_box(label="Answer"), new_exercise = checkbox(default=False, label="New exercise"), show_solution = checkbox(default=False, label="Show solution")): global function, new_ex_state, solution_state if answer == derivative(function(x)) or new_exercise == new_ex_state: new_ex_state = not new_exercise if answer == derivative(function(x)): html("$\\text{Very good! New exercise:}$") function = R.random_element(3, -10,10) elif answer and show_solution != solution_state and new_exercise != new_ex_state: html("$\\text{You've made an error. Try again!}$") html("$\\text{Calculate the derivative: }\;\;\;\;%s$<br>"%latex(function(x))) if show_solution == solution_state: solution_state = not show_solution html("$\\text{Solution: }\;\;\;\;%s$<br>"%latex(derivative(function(x)))) 
       

Click to the left again to hide and once more to show the dynamic interactive window