def steady_state_response_i(zs=(0, 1.0, 0.1), rmin=(0, 1, .1), rmax=(1., 2.0, 0.1)): """Interactive phase plot of steady state response of single degree of freedom system. ``steady_state_response`` is only functional in a `Jupyter notebook <http://jupyter.org>`_. Parameters ---------- zs: array Array with the damping values rmin, rmax: floats Minimum and maximum frequency ratio Returns ------- r: Array Array containing the values for the frequency ratio A: Array Array containing the values for anmplitude Plot with steady state magnitude and phase """ if in_ipynb(): w = interactive(steady_state_response, zs=zs, rmin=rmin, rmax=rmax) display(w) else: print('steady_state_response_i can only be used in an iPython\ notebook.')
def time_plot_i(max_time=(1.0, 100.0), x0=(-100, 100), v0=(-100, 100), m=(1.0, 100.0), c=(0.0, 100.0), k=(1.0, 100.0)): '''Interactive single degree of freedom free reponse plot in iPython ``time_plot_i`` is only functional in a `Jupyter notebook <http://jupyter.org>`_. Parameters ---------- m, c, k : floats, optional mass, damping coefficient, stiffness x0, v0: floats, optional initial displacement, initial velocity max_time: float, optional end time for :math:`x(t)` ''' if in_ipynb(): w = interactive(time_plot, max_time=max_time, v0=v0, m=m, c=c, x0=x0, k=k) display(w) else: print('time_plot_i can only be used in an iPython notebook.') '''
def transmissibility_i(zs=(0, 1.0, 0.1), rmin=0, rmax=2.0): """Interactive phase plot of transmissibility of single degree of freedom system. ``transmissibility_i`` is only functional in a `Jupyter notebook <http://jupyter.org>`_. Parameters ---------- zs: array Array with the damping values rmin, rmax: float Minimum and maximum frequency ratio Returns ------- r: Array Array containing the values for the frequency ratio D: Array Array containing the values for displacement F: Array Array containing the values for force Plot with Displacement transmissibility ratio and force transmissibility ratio """ if in_ipynb(): w = interactive(transmissibility, zs=zs, rmin=rmin, rmax=rmax) display(w) else: print('transmissibility_i can only be used in an iPython notebook.')
def phase_plot_i(max_time=(1.0, 200.0), v0=(-100, 100, 1.0), m=(1.0, 100.0, 1.0), c=(0.0, 1.0, 0.1), x0=(-100, 100, 1), k=(1.0, 100.0, 1.0)): """Interactive phase plot of free response of single degree of freedom system. ``phase_plot_i`` is only functional in a `Jupyter notebook <http://jupyter.org>`_. Parameters ---------- m, c, k: floats, optional mass, damping coefficient, stiffness x0, v0: floats, optional initial displacement, initial velocity max_time: float, optional end time for :math:`x(t)` """ if in_ipynb(): w = interactive(phase_plot, max_time=max_time, v0=v0, m=m, c=c, x0=x0, k=k) plt.show() display(w) else: print('phase_plot_i can only be used in an iPython notebook.')
def phase_plot_i(max_time=(1.0, 200.0), v0=(-100, 100, 1.0), m=(1.0, 100.0, 1.0), c=(0.0, 1.0, 0.1), x0=(-100, 100, 1), k=(1.0, 100.0, 1.0)): '''Interactive phase plot of free response of single degree of freedom system. For information on variables see ``free_response``''' w = interactive(phase_plot, max_time=max_time, v0=v0, m=m, c=c, x0=x0, k=k) display(w)
def time_plot_i(max_time=(1.0, 100.0), v0=(-100, 100), m=(1.0, 100.0), c=(0.0, 100.0), x0=(-100, 100), k=(1.0, 100.0)): w = interactive(time_plot, max_time=max_time, v0=v0, m=m, c=c, x0=x0, k=k) # I'd like to get the sliders to be side by side to take less vertical space # cont = widgets.HBox(children = w) # print(help(w)) display(w)
from IPython.display import display from ipywidgets.widgets.interaction import interactive def f(a, b): display(a + b) return a + b w = interactive(f, a=10, b=20) print(type(w)) display(w)
def duff_bif_phase(k = 0.012): plt.subplot(1,2,1) mu = 0.01; alpha = .2; sigma = 0.05; amax = 1.0 phase_plot(duf_bif_deriv, max_time=100.0, numx = 7, numv = 7, span = (0.01,1.2,-0.5,4), args = (mu, k, alpha, sigma)) plt.xlabel('a') plt.ylabel('$\gamma$') plt.subplot(1,2,2) a, gamma = duff_bif_diag(mu = 0.01, k_int = k, alpha = alpha, sigma = sigma, amax = amax) plt.title('') plt.subplot(1,2,1) sp.reshape(a,(3,1)) plt.plot(sp.reshape(a,(1,3)),sp.reshape(gamma,(1,3)),'*') plt.tight_layout(w_pad=1.5) # This little bit makes the prior function interactive with 'ipcd.display(duff_interact_jump)' duff_interact_jump = interactive(duff_bif_phase, k = (0.0070,0.017,.0004)) def duff_amp_solve(mu = 0.01, k = 0.013, alpha = .2, sigma = (-0.5,.5)): sigma = sp.linspace(sigma[0],sigma[1],1000) #print(sigma.size) #print(sigma) a = sp.zeros((sigma.size,3))*1j first = 1 #print(a) for idx, sig in enumerate(sigma): #print(idx) p = sp.array([alpha**2, 0, -16./3.*alpha*sig, 0, 64./9.*(mu**2 + sig**2),0,-64./9.*k**2]) soln = sp.roots(p) #print('original soln')