julia矩阵运算_Julia中的复数及其运算
生活随笔
收集整理的這篇文章主要介紹了
julia矩阵运算_Julia中的复数及其运算
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
julia矩陣運算
Julia| 復(fù)數(shù) (Julia | Complex Numbers)
The syntax to represent the complex number in Julia is:
在Julia中表示復(fù)數(shù)的語法為:
Syntax:
句法:
A+BimHere, A and B are the values, and im is the global constant which is bound to the complex number i representing the principal square root of -1.
這里, A和B是值, im是全局常數(shù),該常數(shù)綁定到表示-1的主平方根的復(fù)數(shù)i上 。
Example 1:
范例1:
# Julia program to demonstrate the example # of complex numbers and operations on itprintln(1+2im) println((1+2im)+(2+4im))# variables x = 10+23im println("x: ", x) println("typeof(x): ", typeof(x))Output
輸出量
1 + 2im 3 + 6im x: 10 + 23im typeof(x): Complex{Int64}復(fù)數(shù)的各種運算 (Various operations on Complex Numbers)
Example 2:
范例2:
# Julia program to demonstrate the example # of complex numbers and operations on itx = 1+2im y = 2.34+78.909imprintln("x: ", x) println("y: ", y)# operations add = x+y sub = x-y mul = x*y div = x/y exp = x^2# printing println("add: ", add) println("sub: ", sub) println("mul: ", mul) println("div: ", div) println("exp: ", exp)Output
輸出量
x: 1 + 2im y: 2.34 + 78.909im add: 3.34 + 80.909im sub: -1.3399999999999999 - 76.909im mul: -155.478 + 83.589im div: 0.02569885734584168 - 0.011910741155137315im exp: -3 + 4imReference: Julia Complex Numbers
參考: Julia復(fù)數(shù)
翻譯自: https://www.includehelp.com/julia/complex-numbers-and-operations.aspx
julia矩陣運算
總結(jié)
以上是生活随笔為你收集整理的julia矩阵运算_Julia中的复数及其运算的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: array_fill_PHP array
- 下一篇: 颐和园淡旺季时间