List of usage examples for org.apache.commons.math3.complex Complex valueOf
public static Complex valueOf(double realPart, double imaginaryPart)
From source file:org.xlrnet.tibaija.memory.Value.java
/** * Create a new Value object from a real number and an imaginary part. * * @param real// w ww. j a va2s. co m * A real number. * @param imaginary * The imaginary part. * @return A new Value object with a full complex number. */ @NotNull public static Value of(@NotNull Number real, @NotNull Number imaginary) { return of(Complex.valueOf(real.doubleValue(), imaginary.doubleValue())); }
From source file:org.xlrnet.tibaija.processor.InterpretListsTest.java
@Test public void testInterpret_validProgram_add_two_lists() { calculator.interpret("{2+i, 3+2i} + {1,2"); verifyLastResultValueList(Complex.valueOf(3, 1), Complex.valueOf(5, 2)); }
From source file:org.xlrnet.tibaija.processor.InterpretListsTest.java
@Test public void testInterpret_validProgram_list_complex() { calculator.interpret("{123.456i, 12.34"); verifyLastResultValueList(Complex.valueOf(0, 123.456), Complex.valueOf(-12.34)); }
From source file:org.xlrnet.tibaija.processor.InterpretListsTest.java
@Test public void testInterpret_validProgram_multiply_implicit_single_right_list() { calculator.interpret("{1, 2}(2+3.5i)"); verifyLastResultValueList(Complex.valueOf(2, 3.5), Complex.valueOf(4, 7)); }
From source file:org.xlrnet.tibaija.processor.InterpretListsTest.java
@Test public void testInterpret_validProgram_multiply_single_right_list() { calculator.interpret("(2+3.5i) * {1, 2"); verifyLastResultValueList(Complex.valueOf(2, 3.5), Complex.valueOf(4, 7)); }