D
D
dvorkot2014-01-20 18:49:39
Mathematics
dvorkot, 2014-01-20 18:49:39

How to find the square root of a negative number in Pascal?

Actually, subject.
I need to find the root of a negative number, sqrt returns NaN, I'm not strong in mathematics, I have practically no idea about complex numbers, please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tushev, 2014-01-20
@dvorkot

The square root of a negative number is always a complex number, without variations.
In my opinion, there is no work with complex numbers in Pascal. Is it possible to add a library for working with complex numbers. But if you cleanly print the value on the screen then:
root(-N) = root(N) * i
where: "i" is an imaginary unit, it is also a root of minus one.
A complex number in mathematics is written as follows:
a + b * i
where: a is the real part, b is the imaginary part
I.e. We can say that a complex number consists of two parts, real and imaginary.
Read in your school textbook.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question