Two-Dimensional Vector Field Plots

Description

Plotting a vector field for $\mathbf F(x,y) = (\cos x, \sin y)$ with Sage.

Sage Cell

Code

x,y = var('x y')
f = cos(x)
g = sin(y)
plot_vector_field((f,g), (x,-3,3), (y,-3,3))

Options

To plot vectors of the same length, divide by the length of each vector at each point.

To plot a vector field without a frame, use the option frame = False. The default is frame = True.

To change the number of plot points, use plot_points. The default is plot_points=10.

x,y = var('x y')
f = cos(x)
g = sin(y)
plot_vector_field((f,g), (x,-3,3), (y,-3,3))
x,y = var('x y')
f = cos(x)
g = sin(y)
n = sqrt(f^2 + g^2)
plot_vector_field((f/n,g/n), (x,-3,3), (y,-3,3))
x,y = var('x y')
x,y = var('x y')
f = cos(x)
g = sin(y)
plot_vector_field((f,g), (x,-3,3), (y,-3,3), frame = False)
x,y = var('x y')
f = cos(x)
g = sin(y)
plot_vector_field((f,g), (x,-3,3), (y,-3,3),  plot_points=10)

Tags

Primary Tags: two-dimensional plots, multivariable calculus

Secondary Tags: two-dimensional vector field plots

Related Cells

None

Attribute

Permalink:

Author: T. Judson

Date: 21 Jul 2017 11:38

Submitted by: Tom Judson

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License