New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

com.tecacet:komplex

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.tecacet:komplex

A Kotlin module for performing complex number and complex polynomial operations

  • 1.2.1
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

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())

FAQs

Package last updated on 02 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc