
Imaginary Unit in Scilab
When you're working with Scilab and you need to use the imaginary unit, you can simply represent it with the symbol %i.
%i
This nifty little constant is a placeholder for the imaginary unit of complex numbers, often depicted as "i" or "j" in the world of mathematics and engineering.
In essence, the imaginary unit "i" parallels the complex number 0 + i.
But what is this imaginary unit we keep talking about? Essentially, it's the foundational unit of imaginary numbers. Here's a fun fact - when you square the imaginary unit, you get -1. So, $$ i^2 = -1 $$
Let's put this into context with an example.
Imagine you need to write the complex number z=3+4i in Scilab.
It's as simple as typing in the following expression:
z=3 + 4*%i
With your complex number now defined in the variable z, you can easily work out the modulus (or magnitude) of the number using the abs() function.
abs(z);
To bring out the imaginary part of the complex number, the imag() function will do the trick.
5
Per estrarre la parte immaginaria del numero complesso puoi usare la funzione imag()
imag(z)
4
And in the same vein, to pull out the real part of the complex number, you'll want to use the real() function.
real(z)
3
With these coefficients of the imaginary and real parts in your toolkit, you can find out the argument, or the angle of the complex number z, by deploying the arctangent function atan().
atan(imag(z), real(z))
0.9272952