A contour map and 3d plot of two inverse distance functions

Description

Here is a Sage interact that produces a plot and contour map of two inverse distance functions.

Sage Cell

Code

@interact
def _(q1=(-1,(-3,3)), q2=(-2,(-3,3)),
      cmap=['autumn', 'bone', 'cool', 'copper', 'gray', 'hot', 'hsv',
           'jet', 'pink', 'prism', 'spring', 'summer', 'winter']):
     x,y = var('x,y')
     f = q1/sqrt((x+1)^2 + y^2) + q2/sqrt((x-1)^2+(y+0.5)^2)
     C = contour_plot(f, (x,-2,2), (y,-2,2), plot_points=30, contours=15, cmap=cmap)
     show(C, figsize=3, aspect_ratio=1)
     show(plot3d(f, (x,-2,2), (y,-2,2)), figsize=5, viewer='tachyon')

Options

None

Tags

Primary Tags: Multivariable Calculus: Concepts for multivariable functions

Secondary Tags: Concepts for multivariable functions: Traces, contours, and level sets

Related Cells

None

Attribute

Permalink: https://wiki.sagemath.org/interact/calculus#A_contour_map_and_3d_plot_of_two_inverse_distance_functions

Author: William Stein

Date: 01 Jul 2020 21:52

Submitted by: Zane Corbiere

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