B4A Library Math. Complex number library

This library allows to manipulate complex number

class complexe

let z = x + iy
  • Re() as double : Re(z)
  • Im() as double : Im(z)
  • setComplexe(x as double, y as double) : initialize z = x + iy
  • setPolaire(r as double, theta as double) : initialize z = r( cos(theta) + isin(theta) )
  • mod() as double : |z| (abs/modulus/magnitude of z)
  • arg() as double : angle/phase/argument of z
  • conj() as complexe : conjuguate of z -> (x+iy)=(x-iy)

  • add(b as complexe) as complexe : z + b
  • minus(b as complexe) as complexe : z - b
  • mlt(b as complexe) as complexe : z * b
  • div(b as complexe) as complexe : z / b
  • reciproc() as complexe : 1/z

  • exp() as complexe : exp(z) (exponential)
  • log() as complexe : ln(n) (natural log)
  • log10() as complexe : log(n) (log base 10)
  • sqrt() as complexe : square root of z
  • pow(b as complexe) as complexe : z power b (exist only for z^b.x or x^b)

  • sin() as complexe : sinus of z (all function in radian)
  • sinh() as complexe : sinus hyperbolic of z
  • cos() as complexe : cosinus of z
  • cosh) as complexe : cosinus hyperbolic of z
  • tan() as complexe : tan(z)
  • tanh() as complexe : tanh(z)
exemple :

dim z1,z2,z3 as complexe
z1.setComplexe(3,-4)
z1 = z1.conj()
z2 = z1.sqrt()
z3 = z1.add(z2)
Label1.Text = z3.Re() & " -> " & z2.Re() & " -> " & z1.Re()
Label2.Text = z3.Im() & " -> " & z2.Im() & " -> " & z1.Re()​
 

Attachments

  • complexe.zip
    3.2 KB · Views: 311
Last edited:

chavabytes2000

New Member
Licensed User
Longtime User
Excelente libreria... realmente reduce mucho el trabajo de los calculos con numeros complejos... felicidades por tu trabajo y gracias por compartir.
 
Top