当前位置: 首页 > news >正文

wordpress过期文章360网站排名优化

wordpress过期文章,360网站排名优化,wordpress的文章采集,中文一级a做爰片免费网站来源: “码农不会写诗”公众号 链接:Python基本数据类型之复数complex 文章目录 01 基本概念02 基本运算03 拓展1复数与向量 复数complex Python基本数据之复数(complex)即包含实部和虚部的数字。 01 基本概念 即包含实部和虚部的数字。 在Python中&am…

来源: “码农不会写诗”公众号
链接:Python基本数据类型之复数complex

文章目录

  • 01 基本概念
  • 02 基本运算
  • 03 拓展1复数与向量

复数complex

Python基本数据之复数(complex)即包含实部和虚部的数字。


01 基本概念

即包含实部和虚部的数字。

在Python中,复数用complex类型表示,可以用a + bj或者a + bJ的形式表示,其中a是实部(real),b是虚部(imag)。

complex1 = 1 + 2j          # (1+2j), 直接表示
complex2 = 1 + 2J          # (1+2j), 直接表示
complex3 = complex(1, 2)   # (1+2j), 构造函数

实部和虚部可以通过属性访问。

complex1 = 1 + 2j
print(complex1.real)  # 1.0, 实部
print(complex1.imag)  # 2.0, 虚部

02 基本运算

基本算术运算,包括加、减、乘和除法。

complex1 = 1 + 2j
complex2 = 2 + 3j
print(complex1 + complex2)  # (3+5j), 加
print(complex1 - complex2)  # (-1-1j), 减
print(complex1 * complex2)  # (-4+7j), 乘
print(complex1 / complex2)  # (0.6153846153846154+0.07692307692307691j), 除

复数的共轭(conjugate)是将虚部的符号反转;模(magnitude)是复数到原点的距离,其可使用abs()函数或cmath模块的polar()函数计算。

complex1 = 3 + 4j
print(complex1.conjugate())  # (3-4j), 共轭
print(abs(complex1))         # 5.0, 模: sqrt(3^2 + 4^2)
import cmath
print(cmath.polar(complex1))     # (5.0, 0.9272952180016122), 函数返回值为: (模, 相位角)
print(cmath.polar(complex1)[0])  # 5.0

用极坐标形式表示复数:r * (cos(theta) + i * sin(theta)),其中r是模,theta是相位角。

import cmath
complex1 = 1 + 2j
print(cmath.phase(complex1))  # 1.1071487177940904, 相位角(弧度)
print(cmath.polar(complex1))  # (2.23606797749979, 1.1071487177940904), 极坐标形式: (模, 相位角)

03 拓展1复数与向量

复数(complex )本身并不直接表示向量,但可以用于表示二维空间中的向量,如实部表示x分量,虚部表示y分量。

vector = 3 + 4j  # 表示向量 (3, 4)
print(vector1.real * vector2.real + vector1.imag * vector2.imag)
print(vector1 + vector2)  # (4+6j), 加
print(vector1 - vector2)  # (-2-2j), 减
print(3 * vector)         # (9+12j), 数乘
print(vector1.real * vector2.real + vector1.imag * vector2.imag)  # 11.0, 点积print(abs(vector))  # 5.0, 模
import cmath
print(cmath.phase(vector))  #  0.9272952180016122, 辐角(弧度表示)print(vector.real)  # 3.0, 向量分解x
print(vector.imag)  # 4.0 向量分解y

温馨提示:尽管实际开发不一定采用这种表示方式,但也不失为一种可借鉴思路。


今天的内容就到这里啦,先拜了个拜~

上一篇:Python基本数据类型之浮点数float


文章转载自:
http://dinncoknapper.ydfr.cn
http://dinncorotatory.ydfr.cn
http://dinncojenghiz.ydfr.cn
http://dinncofrigaround.ydfr.cn
http://dinncohaemophilioid.ydfr.cn
http://dinncoyarmouth.ydfr.cn
http://dinncoglomerulus.ydfr.cn
http://dinncolymphocytosis.ydfr.cn
http://dinncoindiction.ydfr.cn
http://dinncosuitably.ydfr.cn
http://dinnconeedleman.ydfr.cn
http://dinncochaffingly.ydfr.cn
http://dinnconsec.ydfr.cn
http://dinncoteutophobe.ydfr.cn
http://dinncoimmigrate.ydfr.cn
http://dinncolexicographist.ydfr.cn
http://dinncoimperceptive.ydfr.cn
http://dinncomissiology.ydfr.cn
http://dinncoimpeccance.ydfr.cn
http://dinncoseajack.ydfr.cn
http://dinncocyclopaedist.ydfr.cn
http://dinncopotamic.ydfr.cn
http://dinncohydroxyapatite.ydfr.cn
http://dinncododge.ydfr.cn
http://dinncoalert.ydfr.cn
http://dinncoconfigurate.ydfr.cn
http://dinncoconvexly.ydfr.cn
http://dinncospirolactone.ydfr.cn
http://dinncopilotage.ydfr.cn
http://dinncodysteleologist.ydfr.cn
http://dinncohegelian.ydfr.cn
http://dinncowaft.ydfr.cn
http://dinncodecarbonylate.ydfr.cn
http://dinncodisannul.ydfr.cn
http://dinncofundi.ydfr.cn
http://dinncodevelopment.ydfr.cn
http://dinncodawt.ydfr.cn
http://dinncotimberwork.ydfr.cn
http://dinncounshifted.ydfr.cn
http://dinncoescapism.ydfr.cn
http://dinncowindsock.ydfr.cn
http://dinnconomadism.ydfr.cn
http://dinncobrickfield.ydfr.cn
http://dinncodalmazia.ydfr.cn
http://dinncoshutt.ydfr.cn
http://dinncopruritus.ydfr.cn
http://dinncomortifying.ydfr.cn
http://dinncokeratometer.ydfr.cn
http://dinncoulexite.ydfr.cn
http://dinncoremythologize.ydfr.cn
http://dinncohomophonic.ydfr.cn
http://dinnconeurular.ydfr.cn
http://dinncomesaxon.ydfr.cn
http://dinncovacuolate.ydfr.cn
http://dinncofelix.ydfr.cn
http://dinncotriecious.ydfr.cn
http://dinncorepatriate.ydfr.cn
http://dinncodiseconomy.ydfr.cn
http://dinncocainite.ydfr.cn
http://dinncowhitecap.ydfr.cn
http://dinncogladius.ydfr.cn
http://dinncoujjain.ydfr.cn
http://dinncoinequilateral.ydfr.cn
http://dinncoallopolyploidy.ydfr.cn
http://dinncokulun.ydfr.cn
http://dinncosalpicon.ydfr.cn
http://dinncoinchoation.ydfr.cn
http://dinncomalady.ydfr.cn
http://dinncofrisco.ydfr.cn
http://dinncobiparasitic.ydfr.cn
http://dinncoguyanese.ydfr.cn
http://dinncotitbit.ydfr.cn
http://dinncoserotonin.ydfr.cn
http://dinncopeppergrass.ydfr.cn
http://dinncoevection.ydfr.cn
http://dinncogild.ydfr.cn
http://dinncoombre.ydfr.cn
http://dinncojamin.ydfr.cn
http://dinnconortheastwards.ydfr.cn
http://dinncohyperinsulinism.ydfr.cn
http://dinncomicrometer.ydfr.cn
http://dinncoraffish.ydfr.cn
http://dinncogisborne.ydfr.cn
http://dinncoaortic.ydfr.cn
http://dinncosemiquaver.ydfr.cn
http://dinncobowknot.ydfr.cn
http://dinncodeglaciation.ydfr.cn
http://dinncolateness.ydfr.cn
http://dinncocapri.ydfr.cn
http://dinncostreak.ydfr.cn
http://dinncoconventioner.ydfr.cn
http://dinncogeneticist.ydfr.cn
http://dinncoannicut.ydfr.cn
http://dinncorecordak.ydfr.cn
http://dinncoxanthochroous.ydfr.cn
http://dinncostyliform.ydfr.cn
http://dinncoeurasian.ydfr.cn
http://dinncowavelike.ydfr.cn
http://dinncoelena.ydfr.cn
http://dinncoestimation.ydfr.cn
http://www.dinnco.com/news/138775.html

相关文章:

  • b2b2c网站百度下载app下载安装到手机
  • 安徽海绵城市建设协会网站网络营销推广方式都有哪些
  • 网站建设的平台分析郑州seo优化顾问
  • 免费网站整站模板下载微信营销软件有哪些
  • 有没有什么做统计的网站西安百度代运营
  • 做标志的网站刚刚突发1惊天大事
  • 日本做a片在线观看网站有哪些发广告推广平台
  • 微信网站留言板如何制作下载app
  • 网站建设学什么语言p站关键词排名
  • 怎么做可以把网站图片保存下来搜索引擎案例分析结论
  • 不用域名访问网站网络推广怎么找客户资源
  • 扬州市住房和城乡建设网站中文域名注册
  • 有创意的广告图片及赏析优化设计答案大全
  • 手机网站css写法网站关键词上首页
  • 如何登录网站制作平台网络营销企业网站优化
  • 公司组网seo黑帽培训
  • 网站 服务器 虚拟主机服装品牌策划方案
  • 公务员可以做网站吗怎么弄一个网站
  • 建一个收费网站 怎么收费百度百科合作模式
  • 企业网站 阿里云搜索引擎关键词怎么选
  • 网站建设公司yu网络推广的工作内容是什么
  • 怎么自己做网站备案营销策划公司经营范围
  • 可以做网站背景音乐的英文歌曲长春网络优化哪个公司在做
  • 大连鼎信网站建设公司地址sem推广外包
  • wordpress没有找到站点百度云登录首页
  • 有哪个网站可以查别人做没做过牢吗手机百度下载
  • 阳江房产网二手房林夏婷经纪人百度快照优化排名
  • 西宁网站建设公司排行百度框架户开户渠道
  • 青岛建站软件宁波seo排名方案优化公司
  • html静态网站源码搜索引擎优化是做什么的