Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский
Scilabヘルプ >> Elementary Functions > Complex > complex

complex

複素数を計算する

呼び出し手順

c = complex(u)
c = complex(a, b)

引数

u, a, b
scalars, vectors, matrices or hypermatrices of real numbers. If both a and b are not scalars, they must have the same sizes.

c
array of complex numbers, of the size of u or of a and b. If u is sparse, or if a and b have the same sizes and both are sparse, then c is also sparse. Otherwise c is dense-encoded.

説明

c = complex(u) は, uを実部, 0 を虚部とする複素数を作成します.

c = complex(a,b) は実部a , 虚部bの複素数を作成します.

This function is equivalent to a + imult(b), which handles properly special Inf and NaN real and imaginary parts.

以下の例では,実部と虚部から複素数を生成します.

complex(1,2)
complex([1 2],[3 4])

a のみが指定された場合, 虚部は0に設定されます.

complex([1 2 3])

a がスカラーで b が 行列の場合, 結果 c は, bと同じ大きさとなります. 同様に, b がスカラーで a が行列の場合, 結果 caと同じ大きさになります.

c = complex([1 2 3], 4)
c = complex(1, [2 3 4])

ab が 異なる大きさの行列の場合,以下のセッションのような エラーが発生します.

-->complex(ones(2,3),ones(4,5))
 !--error 10000
complex: Incompatible input arguments #1 and #2: Same sizes expected.
at line      33 of function complex called by :
complex(ones(2,3),ones(4,5))
 

With special real or/and imaginary parts:

r = [0   0    0 %inf %inf %inf %nan %nan %nan].';
i = [0 %inf %nan  0  %inf %nan   0  %inf %nan].';
[r, i]

// Then let's compare complex(r, i) with r + i*%i :
[complex(r,i), r+i*%i]
--> [r, i]
 ans  =
   0.    0.
   0.    Inf
   0.    Nan
   Inf   0.
   Inf   Inf
   Inf   Nan
   Nan   0.
   Nan   Inf
   Nan   Nan

// Then let's compare complex(r, i) with r + i*%i :
--> [complex(r,i), r+i*%i]
 ans  =
   0.  + 0.i    0.  + 0.i
   0.  + Infi   Nan + Infi
   0.  + Nani   Nan + Nani
   Inf + 0.i    Inf + 0.i
   Inf + Infi   Nan + Infi
   Inf + Nani   Nan + Nani
   Nan + 0.i    Nan + 0.i
   Nan + Infi   Nan + Infi
   Nan + Nani   Nan + Nani
 

参照

  • %i — 虚数単位
  • imult — 虚数単位 i を乗じる

履歴

バージョン記述
6.1.1 Extension to sparse arrays.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Jul 20 11:20:42 CEST 2021