• 今年考研?七夕顺便把心形线复习一下


    1. 心形线公式

    心脏线,也称心形线,是外摆线的一种,亦为蚶线的一种,是一个圆上的固定一点在它绕着与其相切且半径相同的另外一个圆周滚动时所形成的轨迹,因其形状像心形而得名。

    在这里插入图片描述

    极坐标下公式有:

    r = a ( 1 − s i n θ ) r = a(1-sin\theta) r=a(1sinθ) r = a ( 1 + s i n θ ) r = a(1+sin\theta) r=a(1+sinθ)

    r = a ( 1 − c o s θ ) r = a(1-cos\theta) r=a(1cosθ) r = a ( 1 + c o s θ ) r = a(1+cos\theta) r=a(1+cosθ)

    Matlab绘制:

    clc,clear,close all;
    theta=-pi:0.001:pi;
    subplot(221)
    r=1-sin(theta);  %心形线方程,“桃p股”朝下
    polarplot(theta,r,'r','LineWidth',1.8);
    title('r=1-sin\theta')
    subplot(222)
    r=1+sin(theta);  %心形线方程,"桃p股”朝上
    polarplot(theta,r,'r','LineWidth',1.8);
    title('r=1+sin\theta')
    subplot(223)
    r=1-cos(theta);  %心形线方程,"桃p股"朝左
    polarplot(theta,r,'b','LineWidth',1.8);
    title('r=1-cos\theta')
    subplot(224)
    r=1+cos(theta);  %心形线方程,"桃p股"朝右
    polarplot(theta,r,'b','LineWidth',1.8);
    title('r=1+cos\theta')
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    在这里插入图片描述

    2. 心形线例题

    1. 求由心形线 r = 4 ( 1 + c o s θ ) r=4(1+cosθ) r=4(1+cosθ),直线 θ = 0 θ=0 θ=0 θ = π 2 θ=\frac{\pi}{2} θ=2π所围图形绕极轴旋转一周所得旋转体的体积.

    r = 4 ( 1 + c o s θ ) r=4(1+cosθ) r=4(1+cosθ)的图像:
    在这里插入图片描述
    r = 4 ( 1 + c o s θ ) r=4(1+cosθ) r=4(1+cosθ) 在 0 - 90°的图像:
    在这里插入图片描述
    与极坐标轴所围面积绕极轴旋转一周得到的旋转体体积详细计算步骤:

    在这里插入图片描述

    1. 改编成选择题,应该选什么呢?
      在这里插入图片描述
      请将答案打在评论区~~

    3. 一些花式心形线

    除了做题,浪漫的Coder们还通过计算机编程作图绘制出了诸多花式心形线

    Python画图:

    import matplotlib.pyplot as plt   
    import numpy as np                
    import math
    
    x = np.linspace(-2,2,500)
    y=lambda x:np.power((x**2),(1/3))+0.99*np.sqrt(3.3-np.power(x,2))*np.sin(9.9*math.pi*x)
    plt.plot(x,y(x))
    plt.axis([-3,3,-2,3])
    plt.show()
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    在这里插入图片描述

    from matplotlib import pyplot as plt
    import numpy as np
    import math
    i = np.linspace(0,2*math.pi,500)
    x=np.cos(i)
    y=np.sin(i)+np.power(np.power(np.cos(i),2),1/3)
    plt.xlim([-1,1])
    plt.plot(x,y)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    在这里插入图片描述
    一位大佬写的Matlab绘制爱心跃动效果:

    clear;  clc;  close all; 
     
    f = @(x, y, z)(x.^2 + 2.25*y.^2 + z.^2 - 1).^3 -  ...
        x.^2.* z.^3 - 0.1125*y.^2.*z.^3;
     
    g = @(x, y, z)(sqrt(x.^2+y.^2)-2.5).^2 + z.^2 - 0.4^2;
     
    t = linspace(-5, 5);
    [x1, y1, z1] = meshgrid(t);
    [x2, y2, z2] = meshgrid(t);
    val1 = f(x1, y1, z1);
    val2 = g(x2, y2, z2);
    [p1, v1] = isosurface(x1, y1, z1, val1, 0);
    [p2, v2] = isosurface(x2, y2, z2, val2, 0);
    figure()
    subplot(1, 1, 1)
    h = patch('faces',p1,'vertices',v1,'facevertexcdata',jet(size(v1,1)),...
        'facecolor','w','edgecolor','flat'); hold on;
     
    patch('faces',p2,'vertices',v2,'facevertexcdata',jet(size(v2,1)),...
        'facecolor','w','edgecolor','flat');
     
    grid on; axis equal; axis([-3,3,-3,3,-1.5,1.5]); view(3)
     
     
    warning('off');
     
    T = title("$I\ Love\ U\ !$"); 
    set(T,'Interpreter','latex','FontSize',24)
    pic_num = 1;
    for i = 1:20
        v1 = 0.98 * v1;
        set(h, 'vertices', v1); drawnow;
        F = getframe(gcf);
        I = frame2im(F);
        [I,map]=rgb2ind(I,256);
        if pic_num == 1 
            imwrite(I,map,'BeatingHeart.gif','gif','Loopcount',inf,'DelayTime',0.05);
        else
            imwrite(I,map,'BeatingHeart.gif','gif','WriteMode','append','DelayTime',0.05);
        end
        pic_num = pic_num + 1;
    end
     
    for i = 1:20
        v1 = v1 / 0.98;
        set(h, 'vertices', v1); drawnow;
        F = getframe(gcf);
        I = frame2im(F);
        [I,map] = rgb2ind(I,256);
        imwrite(I,map,'BeatingHeart.gif','gif','WriteMode','append','DelayTime',0.05);
        pic_num = pic_num + 1;
    end
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53

    在这里插入图片描述
    参考:

    数学的有趣图形-心形线——起源矢量 https://zhuanlan.zhihu.com/p/271674164
    好玩的Matlab 3D心形代码——赖床份子 https://blog.csdn.net/weixin_48117689/article/details/124082260

  • 相关阅读:
    MySQL数据库优化的几种方式(笔面试必问)
    【Python语言速回顾】——数据可视化基础
    恶意代码防范技术笔记(七)
    文举论金:黄金原油全面走势分析策略独家指导
    SpringMVC(二)@RequestMapping注解
    Linux之xinetd安装及实践
    Unity入门05——Unity重要组件和API(2)
    【湖科大教书匠】计算机网络随堂笔记第2章(计算机网络物理层)
    Json文件序列化读取
    阿里云服务器配置怎么选择?小白攻略
  • 原文地址:https://blog.csdn.net/wayne6515/article/details/126168674