YouTube Tutorial: https://youtu.be/t7x3iUJDJyc
Transcription: Hello everyone, my name is Blaec Bejarano. Today, I'll demonstrate how to plot the gradient of a function alongside its contour plot using SageMath in a Jupyter notebook on CoCalc. This example is inspired by Gregory Bard's textbook "Sage for Undergraduates" and attributed to Augustin O'Keefe.
Define the multivariate function .
The gradient of this function can be written in angle bracket notation as:
In the Jupyter notebook, define the function and compute its gradient: f(x,y)=cos(x)-2*sin(y) gradient = derivative(f)
Create the vector field plot of the gradient: plot1 = plot_vector_field(gradient, (x, -5, 5), (y, -5, 5))
Create the contour plot of the function: plot2 = contour_plot(f, (x, -5, 5), (y, -5, 5), fill=True)
Display both plots together: show(plot1 + plot2)
This tutorial showcases CoCalc's ability to perform mathematical computations and visualizations seamlessly within a collaborative environment. Please like, subscribe, and follow for more content. See you next time. Thanks again!
#SageMath #Jupyter #Gradient #ContourPlot #CoCalc
ubuntu2204