python + 数学公式 + 图像 表白 LOVE YOU❤

先来看看效果:
这里写图片描述
来,放公式和代码:
数学公式:

L: y = 1 x y = \frac{1}{x} y=x1
O: x 2 + y 2 = 9 x^2 + y^2 = 9 x2+y2=9
E: x = − 3 ∣ sin ⁡ y ∣ x=-3|\sin y| x=3siny
V: y = ∣ − 2 x ∣ y = |-2x| y=2x
Y: y = ln ⁡ ∣ x ∣ y = \ln |x| y=lnx
U: y = 2 x 2 y = 2x^2 y=2x2
HEART: ( x 2 + y 2 − 1 ) 3 − x 2 y 3 = 0 (x^2+y^2-1)^3-x^2y^3=0 (x2+y21)3x2y3=0

python代码:

import matplotlib.pyplot as plt
import seaborn
import numpy

l = numpy.arange(0, 4, 0.01)
L = 1.0 / l

theta = numpy.arange(-4, 4, 0.01)
o = 3.0 * numpy.cos(theta)
O = 3.0 * numpy.sin(theta)

v = numpy.arange(-4, 4, 0.01)
V = numpy.abs(-2.0 * v)

e = numpy.arange(-3, 3, 0.01)
E = -1.0 * numpy.abs(numpy.sin(e))

y = numpy.arange(-10, 10, 0.01)
Y = numpy.log2(numpy.abs(y))

u = numpy.arange(-4, 4, 0.01)
U = 2.0 * u ** 2

points = []
for heartY in numpy.linspace(-100, 100, 500):
    for heartX in numpy.linspace(-100, 100, 500):
        if ((heartX*0.03)**2+(heartY*0.03)**2-1)**3-(heartX*0.03)**2*(heartY*0.03)**3 <= 0:
            points.append({"x": heartX, "y": heartY})
 
heart_x = list(map(lambda point: point["x"], points))
heart_y = list(map(lambda point: point["y"], points))

fig = plt.figure(figsize=(13, 7))

ax_L = fig.add_subplot(2, 4, 1)
ax_O = fig.add_subplot(2, 4, 2)
ax_V = fig.add_subplot(2, 4, 3)
ax_E = fig.add_subplot(2, 4, 4)
ax_Y = fig.add_subplot(2, 4, 5)
ax_O_2 = fig.add_subplot(2, 4, 6)
ax_U = fig.add_subplot(2, 4, 7)
ax_heart = fig.add_subplot(2, 4, 8)

plt.plot(colos='tomato')
ax_L.plot(l, L)
ax_O.plot(o, O)
ax_V.plot(v, V)
ax_E.plot(E, e)
ax_Y.plot(y, Y)
ax_Y.axis([-10.0, 10.0, -10.0, 5.0])
ax_O_2.plot(o, O)
ax_U.plot(u, U)
ax_heart.scatter(heart_x, heart_y, s=10, alpha=0.5)

seaborn.set_style('whitegrid')

plt.show()
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

白水baishui

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值