この複素数の大きさを得る方法 (1 + 3j)/(4 + 6j)? 分数形式で取得する方法がわかりません。分数の複素数の大きさ
-2
A
答えて
0
複素数の絶対値は、コンポーネントの合計の平方根です。
部門は、その本が必要です。
最後に、この正確な問題に対処するために私のクラスのコピーである this、のように実装されるだろう、http://www.mesacc.edu/~scotz47781/mat120/notes/complex/dividing/dividing_complex.html
。もちろん、それを実装する方法にはアイデアに違いがあります。
/* Copyright (c) 2015 Kevin Wong and Nicholas Colaprete
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package javapy.maths;
/**
* The Complex class represents complex numbers. Complex instances are constant; their values cannot be changed after
* they are created and are hence, immutable.
*
* @author ncolaprete
* @author ifly6
*/
public class Complex {
private final double real;
private final double imaginary;
Complex(double Real, double Imaginary) {
this.real = Real;
this.imaginary = Imaginary;
}
/**
* Returns a string representation of the object in the form <code>a + b<i>i</i></code>.
*
* @return the string representation
*/
@Override public String toString() {
if (this.imaginary == 0) {
return Double.toString(this.real);
} else {
if (this.real == 0) { return this.imaginary + "i"; }
return this.real + "+" + this.imaginary + "i";
}
}
/**
* Returns a double array containing the real part under index 0 and the imaginary part under index 1.
*
* @return An array representation of the number in the form <code>{ real, imaginary }</code>
*/
public double[] toArray() {
return new double[] { this.real, this.imaginary };
}
/**
* Adds this complex number to another one.
*
* @param num - Complex number to add to.
* @return new <code>Complex</code> which is the sum of the two numbers.
*/
public Complex add(Complex num) {
double realfinal = this.real + num.real;
double imagfinal = this.imaginary + num.imaginary;
return new Complex(realfinal, imagfinal);
}
/**
* Subtracts this complex number by another one.
*
* @param num - Complex number to subtract from.
* @return new <code>Complex</code> which is the difference of the two numbers.
*/
public Complex subtract(Complex num) {
double realfinal = this.real - num.real;
double imagfinal = this.imaginary - num.imaginary;
return new Complex(realfinal, imagfinal);
}
/**
* Multiplies this complex number by another one.
*
* @param num - Complex number to multiply with.
* @return new <code>Complex</code> which is the product of the two numbers.
*/
public Complex multiply(Complex num) {
double re = this.real * num.real;
double im = (this.imaginary * num.real) + (num.imaginary * this.real);
double imSqrd = (this.imaginary * num.imaginary) * (-1);
return new Complex(re + imSqrd, im);
}
/**
* Divides this complex number by another one. If it cannot be divided for some reason, then it will return
* <code>null</code>.
*
* @param num - Complex number to divide by.
* @return new <code>Complex</code> which is the quotient of the two numbers.
*/
public Complex divide(Complex num) {
Complex top = this.multiply(num.conjugate());
Complex bottom = num.multiply(num.conjugate());
if (bottom.imaginary == 0) {
return new Complex(top.real/bottom.real, top.imaginary/bottom.real);
} else {
return null;
}
}
/**
* Returns the conjugate of the Complex number.
*
* @return the conjugate
*/
public Complex conjugate() {
return new Complex(real, -imaginary);
}
/**
* Returns this complex number raised to an integer power.
*
* @param power to raise to
* @return the number raised to the given power
*/
public Complex raisedTo(int power) {
Complex to_sender = this;
for (int i = 0; i < power; i++) {
to_sender = to_sender.multiply(to_sender);
}
return to_sender;
}
/**
* Returns the absolute magnitude of complex number on the imaginary plane.
*
* @return absolute magnitude, as double
*/
public double magnitude() {
return Math.sqrt(Math.pow(this.real, 2) + Math.pow(this.imaginary, 2));
}
}
関連する問題
- 1. 大きな数値の素因数分解
- 2. Matlabは大きさと角度を複素数にします
- 3. は、最大の要素(複数可)
- 4. 複数変数の大きな効果
- 5. Jlistの最大数選択された要素の最大数
- 6. TCPDF:大きな画像を複数のページに分割する
- 7. 大きなCSVファイルを複数のファイルに分割する
- 8. 大きなPDFを複数のページファイルに分割するPDFPY
- 9. c# - 大きなファイルを複数のファイルに分割
- 10. React - 大きなコメントコンポーネントを複数のコンポーネントに分割する
- 11. 大きなテキスト文書を複数の小さなテキストファイルに分割する
- 12. 大きなjavascriptファイルを複数の小さなファイルに分割する
- 13. 大きな数字の部分
- 14. 参加複数の大きなテーブル
- 15. Rの複素数
- 16. JPAの大部分は、複数の列で削除し、主キー
- 17. 大きなfastaファイルを複数のファイルに分割するためのbiopythonスクリプト
- 18. 複数変数(分割変数)のggplot
- 19. OpenGL - 複数のデバイスで同じ大きさ
- 20. Gemは画像を複数の大きさにレンダリングする
- 21. のWebPACK:複数分割さバンドル
- 22. Javaの素因数分解
- 23. 複数の要素がクリックされたときの機能
- 24. 複数の小さなデータフレームを複数の小さなデータフレームに分割する
- 25. Zend Lucene&Symfony:1つの大きなインデックスと複数の複数のインデックス
- 26. 複数の最大値
- 27. 無限大と整数倍の複素乗算/除算
- 28. 複数の分割ループで最大値を見つけよう
- 29. Javascript:大きなデータセットを複数の関数に渡す
- 30. 複数配列の配列の分割要素bash
回答が多すぎるか、この回答が長すぎます。回答セットを絞り込むか、いくつかの段落で回答できる問題を特定するための詳細を追加してください。 –
私はAC回路を研究し、時には同様の複素数の大きさを得る必要がある...問題は、分数には数ではなく記号(R、L、C)が含まれているため、これらの分数から大きさを引き出す方法を知る必要がある:D –
あなたの質問はプログラミングとは関係ないと認めています。 –