How to resolve the algorithm Roots of unity step by step in the RLaB programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Roots of unity step by step in the RLaB programming language

Table of Contents

Problem Statement

The purpose of this task is to explore working with   complex numbers.

Given   n,   find the   nth   roots of unity.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Roots of unity step by step in the RLaB programming language

Source code in the rlab programming language

// specify polynomial
>> n = 10;
>> a = zeros(1,n+1); a[1] = 1; a[n+1] = -1;
>> polyroots(a)
   radius               roots           success
>> polyroots(a).roots
   -0.309016994 + 0.951056516i
   -0.809016994 + 0.587785252i
          -1 + 5.95570041e-23i
   -0.809016994 - 0.587785252i
   -0.309016994 - 0.951056516i
    0.309016994 - 0.951056516i
    0.809016994 - 0.587785252i
                        1 + 0i
    0.809016994 + 0.587785252i
    0.309016994 + 0.951056516i

  

You may also check:How to resolve the algorithm Remove duplicate elements step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Luna programming language
You may also check:How to resolve the algorithm Arrays step by step in the Tcl programming language
You may also check:How to resolve the algorithm Phrase reversals step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Password generator step by step in the Swift programming language