Python之练习数学运用代码
2024-08-25 09:11:20
1、对数函数
import math
import matplotlib.pyplot as plt
import numpy as np if __name__ == '__main__':
x = np.arange(0.05,3,0.05)
y1 = [math.log(a,1.5) for a in x]
plt.plot(x,y1,linewidth=2,color='#007500',label='log1.5(x)')
plt.plot([1,1],[y1[0],y1[-1]],"r--",linewidth=2)
y2 = [math.log(a,2) for a in x]
plt.plot(x,y2,linewidth=2,color='#9F35FF',label='log2(x)')
y3 = [math.log(a,3) for a in x]
plt.plot(x,y3,linewidth=2,color='#F75000',label='log3(x)')
plt.legend(loc='lower right')
plt.grid(True)
plt.show()
最新文章
- 在VS2010配置MPI--win7下64位系统
- 云服务器 ECS Linux IO 占用高问题排查方法
- HDU 5475 An easy problem 线段树
- liunx运维面试题汇总二
- logstash 使用grok正则解析日志
- Spark集群搭建中的问题
- ABAP 在屏幕上显示图片
- MongoDB学习笔记(一)
- web框架开发-Django的Forms组件
- JavaWeb学习日记----XML的解析
- 【Visual Studio】Visual Studio对CLR异常的特殊支持
- 导入不用的css文件及在不同设备显示不用的html页面
- 【Linux 命令】- tar 命令
- Java 深入浅出String
- 多进程并发简单socket
- Maven的目录结构和常用命令
- <;Effective C++>;读书摘要--Inheritance and Object-Oriented Design<;二>;
- CSS3不一样的下拉选择框
- Blender 软件 四视图布局的创建方法
- 架构师入门ing