Komplex

A Kotlin module for performing complex number and complex polynomial operations

License

License

GroupId

GroupId

com.tecacet
ArtifactId

ArtifactId

komplex
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

Komplex
A Kotlin module for performing complex number and complex polynomial operations
Project URL

Project URL

https://github.com/algorythmist/komplex
Project Organization

Project Organization

TecAceT
Source Code Management

Source Code Management

https://github.com/algorythmist/komplex

Download komplex

How to add to project

<!-- https://jarcasting.com/artifacts/com.tecacet/komplex/ -->
<dependency>
    <groupId>com.tecacet</groupId>
    <artifactId>komplex</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.tecacet/komplex/
implementation 'com.tecacet:komplex:1.2.1'
// https://jarcasting.com/artifacts/com.tecacet/komplex/
implementation ("com.tecacet:komplex:1.2.1")
'com.tecacet:komplex:jar:1.2.1'
<dependency org="com.tecacet" name="komplex" rev="1.2.1">
  <artifact name="komplex" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tecacet', module='komplex', version='1.2.1')
)
libraryDependencies += "com.tecacet" % "komplex" % "1.2.1"
[com.tecacet/komplex "1.2.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.10

test (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.6.2

Project Modules

There are no modules declared in this project.

komplex

komplex is a Kotlin library for Complex Analysis. It supports complex number and complex polynomial arithmetic.

Complex Arithmetic

import com.tecacet.komplex.*

 val c1 = Complex(2.0, -3.1)
 val c2 = 2 + 3*i
 val c3 = 5*c1 + i*PI

All the standard special functions are defined:

var c = sec(z)
var c = exp(z)
var c = tanh(z)
var c = ln(z)
var c = pow(z, 2.0)
var c = pow(z, z2)

et cetera...

It is also possible to define powers of complex numbers in infix notation:

val c = 1.0 + 0.5 * i
val c10 = c to 10

val c = (1 + 2*i)to 2*i

Complex Polynomials

The library supports complex polynomials and their operations

val p1 = ComplexPolynomial(1 + i, i, 1 + 0 * i)
val p2 = ComplexPolynomial(ONE, i * 2 + 1, i, i - 2)

val p3 = p1 + p2
val p4 = p1 * p2

Division of complex polynomials returns the quotient and remainder:

val dividend = ComplexPolynomial(ONE, ONE, i)
val divisor = ComplexPolynomial(ONE, i)
val (quotient, remainder) = divide(dividend, divisor)

Complex polynomials can be defined using infix notation in terms of the variable Z which represents the first order monomial:

val q = (1.0 + 1.0 * i) * (Z to 3) + 2.0 * (Z to 2) + 1.0 * Z - (1.0 + 0.5 * i)
assertEquals("(-1.0-0.5i)+(1.0)z+(2.0)z^2+(1.0+1.0i)z^3", q.toString())

Versions

Version
1.2.1
1.1.0
1.0.0