public List<Complejo> Raiz(int n) { var raices = new List<Complejo>(); bool binomica = false; if (this.forma == Forma.Binomica) binomica = true; var aux = this.Convertir(Forma.Polar); int i; for (i = 0; i < n; i++) { var raiz = new Complejo(Math.Pow(aux.a, (double)1 / n), (aux.b + 2 * i * Math.PI) / n, Forma.Polar); if (binomica == true) raiz = raiz.Convertir(Forma.Binomica); raices.Add(raiz); } return raices; }
public static Complejo operator -(Complejo izq, Complejo der) { bool polar = false; if (izq.forma == Forma.Polar && der.forma == Forma.Polar) polar = true; izq = izq.Convertir(Forma.Binomica); der = der.Convertir(Forma.Binomica); var resta = new Complejo(izq.a - der.a, izq.b - der.b, Forma.Binomica); if (polar == true) return resta.Convertir(Forma.Polar); return resta; }
public Complejo Potencia(int n) { bool binomica = false; if (this.forma == Forma.Binomica) binomica = true; var aux = this.Convertir(Forma.Polar); var potencia = new Complejo(Math.Pow(aux.a, n), n * aux.b, Forma.Polar); if ( binomica == true ) return potencia.Convertir(Forma.Binomica); return potencia; }