ข้ามไปเนื้อหา

ไฟล์:Vector Field of a Function's Gradient imposed over a Color Plot of that Function.svg

ไม่รองรับเนื้อหาของหน้าในภาษาอื่น
จากวิกิพีเดีย สารานุกรมเสรี

ดูภาพที่มีความละเอียดสูงกว่า((ไฟล์ SVG, 720 × 360 พิกเซล, ขนาดไฟล์: 280 กิโลไบต์))

Wikimedia Commons logo รูปภาพหรือไฟล์เสียงนี้ ต้นฉบับอยู่ที่ คอมมอนส์ รายละเอียดด้านล่าง เป็นข้อความที่แสดงผลจาก ไฟล์ต้นฉบับในคอมมอนส์
คอมมอนส์เป็นเว็บไซต์ในโครงการสำหรับเก็บรวบรวมสื่อเสรี ที่ คุณสามารถช่วยได้

ความย่อ

คำอธิบาย
English: An arrow plot of the gradient of the function , superimposed over a color plot of the values of that function, demonstrating that the gradient yields a vector field of a given function.

The plot was generated using Numpy and Matplotlib in Python 3.11.0 using the following code:

import matplotlib.pyplot as plt
import numpy as np

# Returns the partial derivative with respect to the `i`th parameter of the
# given function. This is done using the method of finite differences 
def partial_derivative(f, i=0, h=0.001e-10):
    def partial(*xs):
        dxs = list(xs)
        dxs[i] = xs[i] + h
        return (f(*dxs)-f(*xs))/h
    return partial

# Returns an np.array (a vector) of partial derivatives with respect to each
# parameter given, ie the gradient
def gradient(f):
    def gradient_of_f(*xs):
        return np.array([partial_derivative(f, i)(*xs) for i in range(len(xs))])
    return gradient_of_f

# The function to be plotted. It contains, by construction, an adjacent 'sink' and
# 'source'. These features demonstrate that the gradient operator yields a vector
# field wherein each vector points from sinks (lower values) to sources (higher values)
def f(x, y):
    return x * np.exp(-1 * (x**2 + y**2))

# Here we construct our domain (the inputs) by discretizing the space between -2 and 2
# into 25 evenly spaced points. This is done for both the x and y dimensions.
n = 25
x = np.linspace(-2, 2, n)
y = np.linspace(-2, 2, n)

# Then we generate a grid of points from our two dimensions, on which we'll evaluate
# the above function
x, y = np.meshgrid(x, y)

# Then we do said evaluating
z = f(x, y)

# And generate it's gradient. Note that `gradient` returns a single array, for plotting
# convenience I've separated out the the dx and dy parts.
dzdx, dzdy = gradient(f)(x, y)

# And finally we generate the plot
plt.figure(figsize=(8, 4))
plt.pcolormesh(x, y, z)
plt.quiver(x, y, dzdx, dzdy, scale=n, pivot='mid', headwidth=4, minshaft=2, minlength=2)
plt.colorbar()
plt.plot()
วันที่
แหล่งที่มา งานของตัว
ผู้สร้างสรรค์ Colejhudson

การอนุญาตใช้สิทธิ

ข้าพเจ้า ในฐานะผู้ถือลิขสิทธิ์ของภาพหรือสื่อนี้ อนุญาตให้ใช้ภาพหรือสื่อนี้ภายใต้เงื่อนไขต่อไปนี้
w:th:ครีเอทีฟคอมมอนส์
แสดงที่มา อนุญาตแบบเดียวกัน
คุณสามารถ:
  • ที่จะแบ่งปัน – ที่จะทำสำเนา แจกจ่าย และส่งงานดังกล่าวต่อไป
  • ที่จะเรียบเรียงใหม่ – ที่จะดัดแปลงงานดังกล่าว
ภายใต้เงื่อนไขต่อไปนี้:
  • แสดงที่มา – คุณต้องให้เกียรติเจ้าของงานอย่างเหมาะสม โดยเพิ่มลิงก์ไปยังสัญญาอนุญาต และระบุหากมีการเปลี่ยนแปลง คุณอาจทำเช่นนี้ได้ในรูปแบบใดก็ได้ตามควร แต่ต้องไม่ใช่ในลักษณะที่แนะว่าผู้ให้อนุญาตสนับสนุนคุณหรือการใช้งานของคุณ
  • อนุญาตแบบเดียวกัน – หากคุณดัดแปลง เปลี่ยนรูป หรือต่อเติมงานนี้ คุณต้องใช้สัญญาอนุญาตแบบเดียวกันหรือแบบที่เหมือนกับสัญญาอนุญาตที่ใช้กับงานนี้เท่านั้น

คำบรรยายโดยย่อ

เพิ่มคำบรรยายทรรทัดเดียวเพื่อขยายความว่าไฟล์นี้มีอะไร
An arrow plot of the gradient of a function, superimposed over a color plot of the values of that function, demonstrating that the gradient yields a vector field of a given function.

รายการที่แสดงอยู่ในไฟล์นี้

ประกอบด้วย

บางค่าที่ไม่มีรายการวิกิสนเทศ

media type อังกฤษ

image/svg+xml

ประวัติไฟล์

คลิกวันที่/เวลาเพื่อดูไฟล์ที่ปรากฏในขณะนั้น

วันที่/เวลารูปย่อขนาดผู้ใช้ความเห็น
ปัจจุบัน02:40, 9 มกราคม 2566รูปย่อสำหรับรุ่นเมื่อ 02:40, 9 มกราคม 2566720 × 360 (280 กิโลไบต์)ColejhudsonUploaded own work with UploadWizard

หน้าต่อไปนี้ โยงมาที่ภาพนี้:

การใช้ไฟล์ข้ามโครงการ

วิกิอื่นต่อไปนี้ใช้ไฟล์นี้:

  • การใช้บน en.wikipedia.org
  • การใช้บน sq.wikipedia.org

ข้อมูลเกี่ยวกับภาพ