本文簡要介紹ruby語言中 Complex.polar
的用法。
用法
polar(abs[, arg]) → complex
返回表示給定極坐標形式的複雜對象。
Complex.polar(3, 0) #=> (3.0+0.0i)
Complex.polar(3, Math::PI/2) #=> (1.836909530733566e-16+3.0i)
Complex.polar(3, Math::PI) #=> (-3.0+3.673819061467132e-16i)
Complex.polar(3, -Math::PI/2) #=> (1.836909530733566e-16-3.0i)
相關用法
- Ruby Complex.phase用法及代碼示例
- Ruby Complex.arg用法及代碼示例
- Ruby Complex.abs2用法及代碼示例
- Ruby Complex.angle用法及代碼示例
- Ruby Complex.to_f用法及代碼示例
- Ruby Complex.cmp / numeric用法及代碼示例
- Ruby Complex.conj用法及代碼示例
- Ruby Complex.infinite?用法及代碼示例
- Ruby Complex.abs用法及代碼示例
- Ruby Complex.rationalize用法及代碼示例
- Ruby Complex.cmp ==用法及代碼示例
- Ruby Complex.imaginary用法及代碼示例
- Ruby Complex.cmp * numeric用法及代碼示例
- Ruby Complex.fdiv用法及代碼示例
- Ruby Complex.rect用法及代碼示例
- Ruby Complex.inspect用法及代碼示例
- Ruby Complex.magnitude用法及代碼示例
- Ruby Complex.-cmp用法及代碼示例
- Ruby Complex.rectangular用法及代碼示例
- Ruby Complex.conjugate用法及代碼示例
- Ruby Complex.real用法及代碼示例
- Ruby Complex.imag用法及代碼示例
- Ruby Complex.cmp - numeric用法及代碼示例
- Ruby Complex.cmp + numeric用法及代碼示例
- Ruby Complex.to_r用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Complex.polar。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。