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

Option

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

Code

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))

Option

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

Code

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)

Option

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

Code

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: Plotting: Two-dimensional plots

Secondary Tags: Two-dimensional plots: Plotting slope fields and vector fields

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