5

I am using IPython widgets to create an interactive plot that will help students understand the determinants of accuracy of various ODE solvers available in scipy.integrate.ode. However, I can't seem to find much in the way of documentation on the various types of widgets and their keyword args.

from IPython.html.widgets import *    

@interact(h=FloatTextWidget(), atol=FloatTextWidget(), rtol=FloatTextWidget(),
          k=IndexSliderWidget(), integrator=TextWidget()))
def plot_lotka_volterra_residuals(h=1e-1, atol=1e-3, rtol=1e-3, k=3, integrator='dopri5'):
    """Plots residuals of the Lotka-Volterra system."""
    # make a pretty plot!

In particular, I would like to know how to set a default value for each widget.

2 Answers 2

1

The declaration of the widgets takes a value keyword argument; you may be able to adapt examples such as this, or try Rossant's detailed Europy tutorial.

Sign up to request clarification or add additional context in comments.

Comments

0

Using ipywidgets, an instance of a control class can be passed to interact.

from ipywidgets import interact, FloatSlider

def update(a):
    print a

interact(update, a=FloatSlider(min=1000., max=100000., step=1000, value=R10, description='Parameter A'))

The GitHub repo has many great examples.

1 Comment

GitHub link is dead

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.