点#
- class sympy.geometry.point.Point(*args, **kwargs)[源代码]#
n维欧几里德空间中的一个点。
- 参数:
坐标 :n坐标值的顺序。在特别节目中
如果n=2或3,将根据需要创建Point2D或Point3D。
评价 如果 \(True\) (默认情况下),所有浮动都变成
准确的类型。
dim :点应具有的坐标数。If坐标
未指定,用0填充。
on_morph :指示当
点的坐标需要通过添加或删除零来改变。可能的值是 \('warn'\) , \('error'\) 或 \(ignore\) (默认)。当 \(*args\) 是空的 \(dim\) 被给予。尝试删除错误时总是引发非零坐标。
- 加薪:
TypeError :当使用除点或序列之外的任何内容实例化时
ValueError :使用长度小于2或
当尝试减少维度if关键字时 \(on_morph='error'\) 被设置。
实例
>>> from sympy import Point >>> from sympy.abc import x >>> Point(1, 2, 3) Point3D(1, 2, 3) >>> Point([1, 2]) Point2D(1, 2) >>> Point(0, x) Point2D(0, x) >>> Point(dim=4) Point(0, 0, 0, 0)
除非evaluate标志为False,否则float将自动转换为Rational:
>>> Point(0.5, 0.25) Point2D(1/2, 1/4) >>> Point(0.5, 0.25, evaluate=False) Point2D(0.5, 0.25)
参见
属性
长度
产地:A \(Point\) 代表着
适当尺寸的空间。
- static affine_rank(*args)[源代码]#
一组点的仿射秩是包含所有点的最小仿射空间的维数。例如,如果点位于一条直线上(且并非全部相同),则其仿射秩为1。如果点位于平面上而不是直线上,则其仿射秩为2。根据惯例,空集具有仿射秩-1。
- property ambient_dimension#
此点的组件数。
- classmethod are_coplanar(*points)[源代码]#
如果存在所有点所在的平面,则返回True。如果 \(len(points) < 3\) 或者所有的点都是二维的。
- 参数:
一组点
- 返回:
布尔
- 加薪:
ValueError :如果给出的唯一点少于3个
实例
>>> from sympy import Point3D >>> p1 = Point3D(1, 2, 2) >>> p2 = Point3D(2, 7, 2) >>> p3 = Point3D(0, 0, 2) >>> p4 = Point3D(1, 1, 2) >>> Point3D.are_coplanar(p1, p2, p3, p4) True >>> p5 = Point3D(0, 1, 3) >>> Point3D.are_coplanar(p1, p2, p3, p5) False
- canberra_distance(p)[源代码]#
堪培拉从自我到p点的距离。
返回到点p的水平和垂直距离的加权和。
- 参数:
p :点
- 返回:
canberra_distance :水平和垂直的加权和
到p点的距离。使用的权重是绝对值的总和
坐标的。
- 加薪:
两个向量都为零时的值错误。
实例
>>> from sympy import Point >>> p1, p2 = Point(1, 1), Point(3, 3) >>> p1.canberra_distance(p2) 1 >>> p1, p2 = Point(0, 0), Point(3, 3) >>> p1.canberra_distance(p2) 2
- distance(other)[源代码]#
自我与另一几何体之间的欧几里德距离。
- 返回:
距离 :数字或符号表达式。
- 加薪:
TypeError :如果其他未被识别为几何体或
未定义距离的几何厘米。
实例
>>> from sympy import Point, Line >>> p1, p2 = Point(1, 1), Point(4, 5) >>> l = Line((3, 1), (2, 2)) >>> p1.distance(p2) 5 >>> p1.distance(l) sqrt(2)
计算的距离也可以是符号:
>>> from sympy.abc import x, y >>> p3 = Point(x, y) >>> p3.distance((0, 0)) sqrt(x**2 + y**2)
- intersection(other)[源代码]#
这个点和另一个几何体的交点。
- 参数:
其他 :几何量或坐标序列
- 返回:
交叉 :点列表
笔记
如果没有交集,则返回值将为空列表,否则将包含此点。
实例
>>> from sympy import Point >>> p1, p2, p3 = Point(0, 0), Point(1, 1), Point(0, 0) >>> p1.intersection(p2) [] >>> p1.intersection(p3) [Point2D(0, 0)]
- is_collinear(*args)[源代码]#
返回 \(True\) 如果存在一行包含 \(self\) 和 \(points\) . 退换商品 \(False\) 否则。如果没有给出点,则返回一个微不足道的真值。
- 参数:
args :点序列
- 返回:
is_collinear :布尔值
实例
>>> from sympy import Point >>> from sympy.abc import x >>> p1, p2 = Point(0, 0), Point(1, 1) >>> p3, p4, p5 = Point(2, 2), Point(x, x), Point(1, 2) >>> Point.is_collinear(p1, p2, p3, p4) True >>> Point.is_collinear(p1, p2, p3, p5) False
- is_concyclic(*args)[源代码]#
做 \(self\) 给定的点序列在一个圆里?
如果点集是共环的,则返回True,否则返回False。如果其他点少于2个,则返回一个普通值True。
- 参数:
args :点序列
- 返回:
is_concyclic :布尔值
实例
>>> from sympy import Point
在单位圆上定义4个点:
>>> p1, p2, p3, p4 = Point(1, 0), (0, 1), (-1, 0), (0, -1)
>>> p1.is_concyclic() == p1.is_concyclic(p2, p3, p4) == True True
定义一个不在该圆上的点:
>>> p = Point(1, 1)
>>> p.is_concyclic(p1, p2, p3) False
- property is_nonzero#
如果任何坐标非零,则为True;如果每个坐标都为零,则为False;如果无法确定,则为None。
- property is_zero#
如果每个坐标都为零,则为True;如果任何坐标不为零,则为False;如果无法确定,则为None。
- property length#
将一个点视为一条直线,则返回一个点的长度为0。
实例
>>> from sympy import Point >>> p = Point(0, 1) >>> p.length 0
- midpoint(p)[源代码]#
自我与p点之间的中点。
- 参数:
p :点
- 返回:
中点 :点
实例
>>> from sympy import Point >>> p1, p2 = Point(1, 1), Point(13, 5) >>> p1.midpoint(p2) Point2D(7, 3)
- property origin#
与当前点具有相同环境尺寸的所有零的点
- property orthogonal_direction#
返回与包含 \(self\) 以及起源。
实例
>>> from sympy import Line, Point >>> a = Point(1, 2, 3) >>> a.orthogonal_direction Point3D(-2, 1, 0) >>> b = _ >>> Line(b, b.origin).is_perpendicular(Line(a, a.origin)) True
- static project(a, b)[源代码]#
突出重点 \(a\) 在原点和点之间的直线上 \(b\) 沿法线方向。
- 参数:
a :点
b :点
- 返回:
p :点
实例
>>> from sympy import Line, Point >>> a = Point(1, 2) >>> b = Point(2, 5) >>> z = a.origin >>> p = Point.project(a, b) >>> Line(p, a).is_perpendicular(Line(p, b)) True >>> Point.is_collinear(z, p, b) True
- taxicab_distance(p)[源代码]#
从自身到p点的出租车距离。
返回到点p的水平和垂直距离的总和。
- 参数:
p :点
- 返回:
taxicab_distance :水平方向的和
以及到p点的垂直距离。
实例
>>> from sympy import Point >>> p1, p2 = Point(1, 1), Point(4, 5) >>> p1.taxicab_distance(p2) 7
- property unit#
返回与方向相同的点 \(self\) 与原点的距离为1
- class sympy.geometry.point.Point2D(*args, _nocheck=False, **kwargs)[源代码]#
二维欧几里德空间中的一个点。
- 参数:
coords
A sequence of 2 coordinate values.
- 加薪:
TypeError
在尝试添加或减去具有不同维度的点时。尝试创建具有两个以上维度的点时。什么时候? \(intersection\) 用对象而不是点调用。
实例
>>> from sympy import Point2D >>> from sympy.abc import x >>> Point2D(1, 2) Point2D(1, 2) >>> Point2D([1, 2]) Point2D(1, 2) >>> Point2D(0, x) Point2D(0, x)
除非evaluate标志为False,否则float将自动转换为Rational:
>>> Point2D(0.5, 0.25) Point2D(1/2, 1/4) >>> Point2D(0.5, 0.25, evaluate=False) Point2D(0.5, 0.25)
参见
属性
X
Y
长度
- property bounds#
xmax,在矩形中表示xmax,表示图形中的xmax。
- property coordinates#
返回点的两个坐标。
实例
>>> from sympy import Point2D >>> p = Point2D(0, 1) >>> p.coordinates (0, 1)
- rotate(angle, pt=None)[源代码]#
旋转
angle
点的逆时针弧度pt
.实例
>>> from sympy import Point2D, pi >>> t = Point2D(1, 0) >>> t.rotate(pi/2) Point2D(0, 1) >>> t.rotate(pi/2, (2, 0)) Point2D(2, -1)
- scale(x=1, y=1, pt=None)[源代码]#
通过乘以来缩放点的坐标
x
和y
减去后pt
--默认值为(0,0)--然后添加pt
又回来了(即。pt
是缩放的参考点)。实例
>>> from sympy import Point2D >>> t = Point2D(1, 1) >>> t.scale(2) Point2D(2, 1) >>> t.scale(2, 2) Point2D(2, 2)
- translate(x=0, y=0)[源代码]#
通过将x和y添加到点的坐标来移动点。
实例
>>> from sympy import Point2D >>> t = Point2D(0, 1) >>> t.translate(2) Point2D(2, 1) >>> t.translate(2, 2) Point2D(2, 3) >>> t + Point2D(2, 2) Point2D(2, 3)
- property x#
返回点的X坐标。
实例
>>> from sympy import Point2D >>> p = Point2D(0, 1) >>> p.x 0
- property y#
返回点的Y坐标。
实例
>>> from sympy import Point2D >>> p = Point2D(0, 1) >>> p.y 1
- class sympy.geometry.point.Point3D(*args, _nocheck=False, **kwargs)[源代码]#
三维欧几里德空间中的一个点。
- 参数:
coords
A sequence of 3 coordinate values.
- 加薪:
TypeError
在尝试添加或减去具有不同维度的点时。什么时候? \(intersection\) 用对象而不是点调用。
实例
>>> from sympy import Point3D >>> from sympy.abc import x >>> Point3D(1, 2, 3) Point3D(1, 2, 3) >>> Point3D([1, 2, 3]) Point3D(1, 2, 3) >>> Point3D(0, x, 3) Point3D(0, x, 3)
除非evaluate标志为False,否则float将自动转换为Rational:
>>> Point3D(0.5, 0.25, 2) Point3D(1/2, 1/4, 2) >>> Point3D(0.5, 0.25, 3, evaluate=False) Point3D(0.5, 0.25, 3)
属性
X
Y
Z
长度
- static are_collinear(*points)[源代码]#
一系列点是共线的吗?
一组点是否共线。如果点集共线,则返回True,否则返回False。
- 参数:
点 :点序列
- 返回:
are_collinear :布尔值
实例
>>> from sympy import Point3D >>> from sympy.abc import x >>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 1) >>> p3, p4, p5 = Point3D(2, 2, 2), Point3D(x, x, x), Point3D(1, 2, 6) >>> Point3D.are_collinear(p1, p2, p3, p4) True >>> Point3D.are_collinear(p1, p2, p3, p5) False
- property coordinates#
返回点的三个坐标。
实例
>>> from sympy import Point3D >>> p = Point3D(0, 1, 2) >>> p.coordinates (0, 1, 2)
- direction_cosine(point)[源代码]#
给出两点之间的方向余弦
- 参数:
p :点3D
- 返回:
列表
实例
>>> from sympy import Point3D >>> p1 = Point3D(1, 2, 3) >>> p1.direction_cosine(Point3D(2, 3, 5)) [sqrt(6)/6, sqrt(6)/6, sqrt(6)/3]
- direction_ratio(point)[源代码]#
给出两点之间的方向比
- 参数:
p :点3D
- 返回:
列表
实例
>>> from sympy import Point3D >>> p1 = Point3D(1, 2, 3) >>> p1.direction_ratio(Point3D(2, 3, 5)) [1, 1, 2]
- intersection(other)[源代码]#
这个点和另一个几何体的交点。
- 参数:
其他 :几何量或坐标序列
- 返回:
交叉 :点列表
笔记
如果没有交集,则返回值将为空列表,否则将包含此点。
实例
>>> from sympy import Point3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(0, 0, 0) >>> p1.intersection(p2) [] >>> p1.intersection(p3) [Point3D(0, 0, 0)]
- scale(x=1, y=1, z=1, pt=None)[源代码]#
通过乘以来缩放点的坐标
x
和y
减去后pt
--默认值为(0,0)--然后添加pt
又回来了(即。pt
是缩放的参考点)。实例
>>> from sympy import Point3D >>> t = Point3D(1, 1, 1) >>> t.scale(2) Point3D(2, 1, 1) >>> t.scale(2, 2) Point3D(2, 2, 1)
参见
- translate(x=0, y=0, z=0)[源代码]#
通过将x和y添加到点的坐标来移动点。
实例
>>> from sympy import Point3D >>> t = Point3D(0, 1, 1) >>> t.translate(2) Point3D(2, 1, 1) >>> t.translate(2, 2) Point3D(2, 3, 1) >>> t + Point3D(2, 2, 2) Point3D(2, 3, 3)
参见
- property x#
返回点的X坐标。
实例
>>> from sympy import Point3D >>> p = Point3D(0, 1, 3) >>> p.x 0
- property y#
返回点的Y坐标。
实例
>>> from sympy import Point3D >>> p = Point3D(0, 1, 2) >>> p.y 1
- property z#
返回点的Z坐标。
实例
>>> from sympy import Point3D >>> p = Point3D(0, 1, 1) >>> p.z 1