In this post we describe how derivatives are defined in higher dimensions, when dealing with multi-input functions. We explore these ideas first with $N=2$ inputs for visualization purposes, generalizing afterwards.
Press the button 'Toggle code' below to toggle code on and off for entire this presentation.
from IPython.display import display
from IPython.display import HTML
import IPython.core.display as di # Example: di.display_html('<h3>%s:</h3>' % str, raw=True)
# This line will hide code by default when the notebook is exported as HTML
di.display_html('<script>jQuery(function() {if (jQuery("body.notebook_app").length == 0) { jQuery(".input_area").toggle(); jQuery(".prompt").toggle();}});</script>', raw=True)
# This line will add a button to toggle visibility of code blocks, for use with the HTML export version
di.display_html('''<button onclick="jQuery('.input_area').toggle(); jQuery('.prompt').toggle();">Toggle code</button>''', raw=True)
In this Section we describe how the notion of a derivative for single-input functions is naturally generalized to multi-input functions.
along with their tangent line / hyperplane at the origin
# plot a single input quadratic in both two and three dimensions
func1 = lambda w: 2 + np.sin(w)
func2 = lambda w: 2 + np.sin(w[0] + w[1])
# use custom plotter to show both functions
callib.derivative_ascent_visualizer.compare_2d3d(func1 = func1,func2 = func2)
# what function should we play with? Defined in the next line, along with our fixed point where we show tangency.
g = lambda w: np.sin(w)
# create an instance of the visualizer with this function
st = callib.secant_to_tangent.visualizer(g = g)
# run the visualizer for our chosen input function and initial point
st.draw_it(w_init = 0, num_frames = 200)