python函数示例_带Python示例的complex()函数

python函数示例

Python complex()函数 (Python complex() function)

complex() function is a library function in Python, it is used to get the complex number from given a real number or/and an imaginary number (which is an optional part), it accepts either a real number only or read and an imaginary number and returns a complex number.

complex()函数是Python中的一个库函数,用于从给定的实数或/和虚数(这是可选部分)中获取复数,它仅接受实数,也可以接受读数和虚数数字并返回一个复数。

Syntax:

句法:

    complex(real [,Imaginary])

Parameter(s):

参数:

  • real – value of a real number

    实数 –实数的值

  • Imaginary – an optional parameter, it's default value is 0.

    虚构 –可选参数,默认值为0。

Return value: complex – it returns a complex type of number containing the value in the form of (real + imaginary*j).

返回值: complex –返回复杂的数字类型,其中包含(real +虚数* j)形式的值。

Example:

例:

    Input:
real = 10
img  = 20
print(complex(real))
print(complex(real, img))
Output:
(10+0j)
(10+20j)

Python code to get the complex number

Python代码获取复数

# python code to demonstrate example 
# of complex() function
real = 10
img  = 20
# complex number  by passing real number
print(complex(real))
# complex number  by passing real & img. number
print(complex(real, img))
# complex number by passing real part as 0
print(complex(0))
# complex number by passing real and img. part as 0, 0
print(complex(0,0))
# with float values
real = 10.23
img  = 20.45
# complex number  by passing real number
print(complex(real))
# complex number  by passing real & img. number
print(complex(real, img))

Output

输出量

(10+0j)
(10+20j)
0j
0j
(10.23+0j)
(10.23+20.45j)

翻译自: https://www.includehelp.com/python/complex-function-with-example.aspx

python函数示例

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/542971.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

windows 下 git 禁用 CRLF 转换 LF

2019独角兽企业重金招聘Python工程师标准>>> windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行add . 时出现提示,解决办法: 删除根目录 .git 文件夹禁用自动转换 > git config --global core.autocrl…

cmd执行sql文件路径 oracle_oracle 基础 执行sql文件

Oracle执行外部文件:sql>new.sql执行多个sql文件:1.把所有的文件都放在同一个目录下,然后在命令行里执行命令:c:>dir/b > d:/1.sql会把所有的sql文件名都输出到一个sql文件中。2.用UltraEdit打开生成的sql文件,altC切换到…

获取天气html,使用htmlparser获取sohu的天气预报

首先,我们新建一个类,存放天气信息/** Created on 2005-3-8** To change the template for this generated file go to* Window>Preferences>Java>Code Generation>Code and Comments*/packageorg.exoplatform.portlets.chinaweather.compon…

使用gulp构建前端(三)

为什么80%的码农都做不了架构师?>>> 使用gulp构建前端(三) 紧接着上述文章内容,开始新的插件的使用 插件三 gulp-clean-css,作用减小文件大小,并给引用url添加版本号避免缓存,一个需…

c++中atan2函数_atan2()函数以及C ++中的示例

c中atan2函数C atan2()函数 (C atan2() function) atan2() function is a library function of cmath header, it is used to find the principal value of the arc tangent of y/x, where y is the proportion of the y-coordinate and x is the proportion of the x-coordin…

python不合法的布尔表达式_python测试题

一、填空题 1.Python使用符号标示注释;以划分语句块。 2、Python序列类型包括 、、三种; 是Python中唯一的映射类型。 3、Python中的可变数据类型有,不可变数据类 型有。 4、Python的数字类型分为、、等子类型。 5、设s=‘abcdefg’,则s[3]值是 ,s[3:5]值是 , s[:5]值是…

网站html标签如何优化,网站HTML标签优化教程

真正需要SEOer掌握并经常使用的HTML标签也就那么几个,本小节丈哥seo带来的是页面HTML标签优化。title标签 – 标题标签1)title标签用法网站SEOHTML标签优化教程 – 丈哥seo2)标题标签的作用关于网站标题写法与操作技巧有许多,需要怎么优化标题的朋友可以…

hypot函数_hypot()函数与C ++中的示例

hypot函数C hypot()函数 (C hypot() function) hypot() function is a library function of cmath header, it is used to find the hypotenuse of the given numbers, it accepts two numbers and returns the calculated result of hypotenuse i.e. sqrt(x*x y*y). hypot()…

docker 磁盘问题:device or resource busy

问题:[roothdp-gp-dk02 ~]# docker start 01ea65845e45Error response from daemon: Cannot start container 01ea65845e45: Error getting container 01ea65845e4547be24bc3db0bc3b424faf52b8a0534eb525aa829dd9fd6081c2 from driver devicemapper: Error mounting…

axure form列表_常见的列表页如何用Axure画出来

列表页是PM画原型的时候最容易碰到的页面类型,那么如何快速画出并且展现交互呢?我们从具体的例子开始讲解其中的技巧,和各种不同的演变场景。希望初级PM可以通过这篇文章改进下自己的画法。列表页基本是由页面框架,上导航&#xf…

python中divmod_divmod()函数以及Python中的示例

python中divmodPython divmod()函数 (Python divmod() function) divmod() function is a library function, it is used to get the quotient and remainder of given values (dividend and divisor), it accepts two arguments 1) dividend and 2) divisor and returns a tup…

html 轮播图的鼠标事件,这是图片轮播的代码 html+css,怎么加上鼠标悬停移出继续功能?...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼.one {position: absolute;width: 500px;height: 400px;overflow: hidden;}.one_cantent img {width: 500px;height: 300px;float: left;}.one_cantent {width: 2500px;height: 400px;position: absolute;left: 0px;animation-name…

微软Azure云之企业Exchange 2016部署12—配置负载平衡

上几节我们把Exchange2016邮箱系统配置完毕了,本节我们来配置开通需要对外的端口,并对这些端口进行负载均衡配置,如下图红框所示:1.Exchange服务端口Exchange2016需要对外开通以下的端口,来对外提供不同的服务&#xf…

linux多线程求和_linux多线程pthread系列函数详解

linux多线程pthread系列函数详解(一)为什么要引入线程线程技术早在60年代就被提出,但是在80年代才真正使用到操作系统中。传统UNIX也支持多线程概念,但在一个进程中只允许有一个线程,这样多线程就意味着多进程。现在多线程技术已经被很多操作…

python独立log示例_带有Python示例的math.log()方法

python独立log示例Python math.log()方法 (Python math.log() method) math.log() method is a library method of math module, it is used to get the natural logarithm of a given number to base e (by default). It accepts the number and a base (which an optional) a…

搭建云计算机win10,win10电脑做云服务器

弹性云服务器 ECS弹性云服务器(Elastic Cloud Server)是一种可随时自助获取、可弹性伸缩的云服务器,帮助用户打造可靠、安全、灵活、高效的应用环境,确保服务持久稳定运行,提升运维效率三年低至5折,多种配置可选了解详情Windows远…

聚类分析在用户行为中的实例_用户关注行为数据分析过程详解-描述统计+聚类...

以下是基于一小段用户关注产品的行为数据分析过程详细描述,各位老师如有不同意见或优化建议,还请不吝赐教。一、数据大致是这样的(已经脱敏处理)二、数据预处理从年款提取出年限,从价格标识出价格区间,随便写一下SQL如下&#xff…

centos下升级jdk版本

2019独角兽企业重金招聘Python工程师标准>>> 由于安装的centos系统,自带了jdk1.6和1.7的版本,介于在平时开发,用了1.8.为了保持开发环境的一致,故此需要升级,放办maven打包等工具的使用。 查看系统的jdk版本…

学英语要用计算机吗,学计算机的人是否要学英语?

我记得在我大一的时候,那个时候还没有程序课呢.不过我是很喜欢计算机这个专业的,我也非常想学习编程语言,所以当时即使没有程序课,我也是借了一本VB的书回家来看.当时就在VB的贴吧乱看,大概贴吧里有一个人气很高的一位高手,写了好多文章,也帮人解决好多问题.在他的观点中,他认为…

语言之输出png图片_什么是PPML?如何输出PPML文档?

什么是PPML?PPML是由PODi联盟的几个会员公司共同开发出一种个性化印刷标识语言,这是一种全新的、基于XML(可扩展标识语言)技术的印刷行业标准语言,得到越来越多的业内人士关注。PPML采用XML作为句法基础,使PPML其他很多…