るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.014秒)
トップページ > クエリ:![x] > クエリ:Complex[x]

別のキーワード

  1. _builtin slice!
  2. _builtin select!
  3. _builtin reject!
  4. string slice!
  5. string gsub!

種類

ライブラリ

モジュール

検索結果

Kernel.#Complex(r, i = 0) -> Complex (18328.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。


@raise ArgumentError 変換...
...生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r に...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.new、Complex.new! は 1.9 系...

Kernel.#Complex(r, i = 0, exception: true) -> Complex | nil (18328.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。

@param exception false を...
...生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r に...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.new、Complex.new! は 1.9 系...

Kernel.#Complex(s) -> Complex (18328.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。


@raise ArgumentError 変換...
...生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r に...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.new、Complex.new! は 1.9 系...

Kernel.#Complex(s, exception: true) -> Complex | nil (18328.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

...実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

@param s 生成する複素数を表す文字列。

@param exception false を...
...生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r に...
...計算した Complex オブジェクトを返しま
す。

//emlist[例][ruby]{
Complex
('1+1i', '2+3i') # => (-2+3i)
Complex
('1+1i') + Complex('2+3i') * Complex('i') # => (-2+3i)
//}

@see Complex.rect、Complex.rectangular

[注意] Complex.new、Complex.new! は 1.9 系...

1.6.8から1.8.0への変更点(まとめ) (36.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...中だけになりました。

: rescue 節の例外クラスと発生した例外オブジェクトの比較 [ruby] [change]

発生した例外 $! と rescue 節の例外クラスとは ((<Module#===|Module/===>))
を使って比較するようになりました。

以前は kind_of? に...
...int|Numeric/to_int>)) [new]

追加。

=== Hash

: ((<Hash#merge|Hash/merge>)) [new]
: ((<Hash#merge!|Hash/merge!>)) [new]

追加。Hash#merge は、hash.dup.update と同じ。
Hash#merge! は、Hash#update の別名 ((<ruby-talk:59777>)), ((<ruby-dev:19463>))

: ((<Hash#default_proc|Hash/d...
...or using the mouse, character
attributes, colors and key codes have been added.

: Complex#to_i [lib] [obsolete]
: Complex#to_f [lib] [obsolete]
: Complex#to_r [lib] [obsolete]

Complex
#to_i, #to_f, #to_r はなくなりました。
((<ruby-bugs-ja:PR#102>)), ((<ruby...

絞り込み条件を変える

NEWS for Ruby 2.1.0 (36.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...付けると虚数単位 i を掛けた数になる
42i # => Complex(0, 42)
3.14i # => Complex(0, 3.14)

# ri を付けると複素数の虚部が有理数になる
42ri # => Complex(0, 42r)
3.14ri # => Complex(0, 3.14r)
//}

* def によるメソッド定義式は nil の...
...s

* String
* "literal".freeze は同じオブジェクトを返すように最適化されました。
* 追加: String#scrub, String#scrub! 不正なバイト列を検証して修正します。
古いバージョンのRubyと一緒に使いたいときは string-scrub gem を使...
...シンボルは freeze されるようになりました

* pack/unpack (Array/String)
* プラットフォームが対応していれば Q! と q! は long long 型を表します

* toplevel
* main.using はもはや実験的な機能ではありません。
The method activates...

NEWS for Ruby 2.7.0 (24.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...を止める例:

//emlist{
$ ruby -e '0 in a'
-e:1: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!

$ ruby -W:no-experimental -e '0 in a'
//}

* RUBYOPTで両方止めるにはスペース区切りで指定します:

//emlist{
$ RUBYOPT='-W:no-...
...clamp(0..2) #=> 1
3.clamp(0..2) #=> 2
# With beginless and endless ranges:
-1.clamp(0..) #=> 0
3.clamp(..2) #=> 2
//}

* Complex
* 新規メソッド
* Complex#<=>が追加されました。
その結果、「0 <=> 0i」がNoMethodErrorを発生しなくなりました。 158...
...st[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
p e.class #=> Enumerator
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
//}
//emlist[Enumerator::Lazy#with_index][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts...

Ruby用語集 (18.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...前。

: shebang
シバンまたはシェバンと読む。
一般に Unix 系 OS のスクリプトにおいて、第 1 行に配置される #! で始まる行をいう。
スクリプトを処理すべき処理系やそのコマンドラインオプションを指定するのに
用い...
...はなく Integer
クラスのインスタンスを指すことが多いので注意。

例えば 1.0(Float)、1r(Rational)、1+0i(Complex)はいずれも
数学的には 1 を表しており、整数であるが、Integer オブジェクトではない。

「Integer オブジ...
...ールの mix-in という仕組みがある。

→ミックスイン

: 単項演算子
: unary operator
単一の項に働く演算子。+ - ! not などが該当する。

: 単体テスト
: unit testing
=ユニットテスト

: 短絡評価
: short-circuit evaluation
論理式の評...