Another interesting example...

Solve: \( \sqrt{i} = z \)

Not at all complicated task, it have two solutions. However, we will get interesting results from the Prime, depending how we formulate it for solving.

Let try first simply \( \sqrt{i} \), it returns \( \frac{1+i}{\sqrt{2}} \)

Let try further solve((sqrt(i)) = z,z), result is \( \left \{ \frac{1+i}{\sqrt{2}} \right \} \)

However: solve((i) = (z^2),z), result is \( \left \{ \frac{1+i}{\sqrt{2}}, -{\frac{1+i}{\sqrt{2}}} \right \} \)

An obvious path for lower grade students to solve it, is to use elementary definition of a complex number. Another solution can be using Euler's formula...

However, the Prime unexpectedly gave different number of solutions, depending on how formula is written...

Disclaimer: Tested on latest public beta emulator only.

(10-25-2018 07:17 AM)sasa Wrote: [ -> ]Another interesting example...

Solve: \( \sqrt{i} = z \)

Not at all complicated task, it have two solutions. However, we will get interesting results from the Prime, depending how we formulate it for solving.

Let try first simply \( \sqrt{i} \), it returns \( \frac{1+i}{\sqrt{2}} \)

Let try further solve((sqrt(i)) = z,z), result is \( \left \{ \frac{1+i}{\sqrt{2}} \right \} \)

However: solve((i) = (z^2),z), result is \( \left \{ \frac{1+i}{\sqrt{2}}, -{\frac{1+i}{\sqrt{2}}} \right \} \)

An obvious path for lower grade students to solve it, is to use elementary definition of a complex number. Another solution can be using Euler's formula...

However, the Prime unexpectedly gave different number of solutions, depending on how formula is written...

Disclaimer: Tested on latest public beta emulator only.

I expect that the Prime treats the square root function as a single-valued function, so that (for example) \(\sqrt4=+2\) only and solving \(\sqrt4=x\) only returns \(x=2\) as a solution. The Prime views the equations \(\sqrt4=x\) and \(4=x^2\) as two different equations with one and two roots respectively; I think that this is the behaviour I would expect. What do others feel?

Nigel (UK)

z=sqrt(i) is a polynomial equation of degree 1 in z, therefore it has a unique solution. z^2=i is a polynomial equation of degree 2 in z, therefore it has 2 solutions (in C). This is what is called d'Alembert theorem (in France) or fundemental theorem of algebra in English speaking countries (I think).

I wonder how can sasa pretend that the Prime answer is unexpected.

sasa, would you also have expected two solutions from solve((sqrt(2)) = z, z)?

(10-25-2018 10:52 AM)parisse Wrote: [ -> ]I wonder how can sasa pretend that the Prime answer is unexpected.

Actually, I do not... Here what is a deal:

if we have: \( \sqrt{i}=z \), it is the first degree polynomial and actually

exact solution, as sqrt from any constant is again a constant - there is nothing to simplify. Hence, we fully agree that the (

i) is a constant. This way it is pointless to do any solving, as well as fundamental theorem state. Actually, if we need to "transform" \( \sqrt{i} \), exact alternative would be: (\(-1)^{\frac{1}{4}}\). Alternate form as \(\frac{1+i}{\sqrt{2}}\) is not quite correct - anyone is free to prove differently.

if we have: \( i=z^{2} \) we know that it is second degree polynomial with two solutions.

Simply just another sample from the twilight zone...

(10-25-2018 04:43 PM)sasa Wrote: [ -> ]if we have: \( \sqrt{i}=z \), it is the first degree polynomial and actually exact solution, as sqrt from any constant is again a constant - there is nothing to simplify. Hence, we fully agree that the (i) is a constant. This way it is pointless to do any solving, as well as fundamental theorem state. Actually, if we need to "transform" \( \sqrt{i} \), exact alternative would be: (\(-1)^{\frac{1}{4}}\). Alternate form as \(\frac{1+i}{\sqrt{2}}\) is not quite correct - anyone is free to prove differently.

So you're objecting to it factoring out the radical part as a real number? I think \(\frac{1+i}{\sqrt{2}}\) is easier to visualize than \(\sqrt{i}\).

(10-25-2018 04:43 PM)sasa Wrote: [ -> ]...

Actually, if we need to "transform" \( \sqrt{i} \), exact alternative would be: (\(-1)^{\frac{1}{4}}\). Alternate form as \(\frac{1+i}{\sqrt{2}}\) is not quite correct - anyone is free to prove differently.

I don't understand why \((1+i)/\sqrt2\) is "not quite correct" as the value of \(\sqrt{i}\). Squaring it does give \(i\), and, assuming that the square root function on the Prime has a cut along the negative real axis in the complex plane, this value is the correct analytic continuation of the square root function defined in the usual way for non-negative real numbers.

Can you explain what the problem is?

Nigel (UK)

(10-25-2018 05:14 PM)ijabbott Wrote: [ -> ]So you're objecting to it factoring out the radical part as a real number? I think \(\frac{1+i}{\sqrt{2}}\) is easier to visualize than \(\sqrt{i}\).

I think sasa wanted both of the roots.

So, the idea is to return sqrt(i), unevaluated.

Multiple solutions also work, so sqrt(z) is not mapped 1-to-1, but 1-to-2

http://mathforum.org/library/drmath/view/52243.html
Albert,

That is exactly the point.

Since here \(\frac{1+i}{\sqrt{2}}\) is just a "principal value", equally good/bad could be \(-\frac{1+i}{\sqrt{2}}\). Furthermore, logical question here is how to choose "principal value"? The answer is: arbitrary.

That is the reason to keep it as is, since evaluating it in an expression with "principal value", we may get result we hardly expect. It is probably not likely to happens in most of practical uses, but it is theoretically possible.

I disagree completly, sqrt is uniquely defined, in maths and in software. Trying to do something else would be confusing for students and not realistic in software.

(10-26-2018 02:47 PM)parisse Wrote: [ -> ]I disagree completly, sqrt is uniquely defined, in maths and in software. Trying to do something else would be confusing for students and not realistic in software.

Your general attitude so far was that students current knowledge level and ability of understanding is not relevant for CAS. But now, with just fundamentals in complex analysis, it starts to be relevant...

With Wolfram Alpha, all upper stated issues was covered precisely. As well, even Riemann surface visualisation is introduced (though, still as beta, if I do not mistaken). I doubt the Prime is ready to deal properly with multivalued functions...

What level of complex analysis is anyway implemented in CAS for Prime?

(10-26-2018 06:33 AM)sasa Wrote: [ -> ]Albert,

That is exactly the point.

Since here \(\frac{1+i}{\sqrt{2}}\) is just a "principal value", equally good/bad could be \(-\frac{1+i}{\sqrt{2}}\). Furthermore, logical question here is how to choose "principal value"? The answer is: arbitrary.

That is the reason to keep it as is, since evaluating it in an expression with "principal value", we may get result we hardly expect. It is probably not likely to happens in most of practical uses, but it is theoretically possible.

I now understand your point, but I do not agree that the Prime's current behaviour is wrong. My reasons:

- People normally assume that \(\sqrt{z}\) is single-valued. As evidence for this assertion, I point to the universal appearance of \(\pm\) in front of the square root in the formula for the roots of a quadratic equation.
- Sometimes people genuinely need to know the value of the square root of a complex number. If I'm looking at a damped simple harmonic oscillator, the real and imaginary parts of \(\omega\) have separate meanings and I would like to see them separately.
- As an educational point, it is good to show students that the square root (or any other power) of a complex number is again a complex number. Leaving \(\sqrt{i}\) unevaluated when an exact representation is possible would make a mystery where there is none.
- Suppose that instead of remaining unevaluated, \(\sqrt{z}\) did return a list of two values. This list would double in size each time another square root was taken. This would quickly become impractical.
- Another suggestion you made in an earlier post is to re-write \(\sqrt{i}\) as \((-1)^{1/4}\), which is what Wolfram Alpha does. This works for Wolfram Alpha because it regards both the square root and the power as functions, each returning a single value. It wouldn't work here because if you wish the square root to have two values, then you would have to allow that \((-1)^{1/4}\) has four values, so one would not be an acceptable re-writing of the other.
- Finally - and perhaps most importantly - I just do not see the problem with the current situation. Students learning about complex numbers already know that although \(x^2=4\) has two solutions, \(\sqrt4=+2\). This matches perfectly with what the Prime does with complex (and real) numbers. Students do not need to know about Riemann surfaces to be able to answer exam questions such as: Write \(\sqrt{i}\) in the form \(a+bi,\quad a,b\in R\).

If this comes across as grumpy and aggressive, I apologise: that certainly isn't my intention.

Best wishes!

Nigel (UK)

(10-27-2018 10:04 AM)Nigel (UK) Wrote: [ -> ]...

[*]People normally assume that \(\sqrt{z}\) is single-valued. As evidence for this assertion, I point to the universal appearance of \(\pm\) in front of the square root in the formula for the roots of a quadratic equation.

...

Nigel (UK)

+1

See

http://mathforum.org/library/drmath/view/53873.html (and the first link on that page) for the inconsistencies we get when assuming sqrt() returns more than one value...

@sasa:

A student does not expect two answers when running sqrt(), independently of the type of the argument. sqrt(4.0) return 2.0 (approx), sqrt(4) returns 2 in a CAS. Returning two values would confuse them, how can you argue the contrary?

BTW, Wolfram Alpha returns one value for sqrt(i) :-)

As for complex analysis support inside Giac: some integrals are computed using the residue method, and there is a residue command.

Reading all these attacks from sasa, I wonder why... Perhaps students are beginning to buy Primes instead of using Mathematica or Wolfram Alpha :-)

Ok, I think I've lost enough time in this thread, bye!