Created attachment 121313 [details] You can see the wrong plot of the function x^(1/3) SUMMARY The software "KAlgebra" gives bad results both in the calculation mode and in the graphical mode STEPS TO REPRODUCE 1. Open KAlgebra 2. Go to the section "2D plot" 3. Then try to plot the following function: f(x) = x^(1/3), by writing in the text box on the right, just below the word "Function". 4. The result can be reproduced exactly in the same way by going to the section "Calculator" instead of "2D plot" and trying to calculate the following expression: (-2)^(1/3) OBSERVED RESULT The function plotted in the 2D plot is given in the attachment. For the calculator mode we find the result 0.629960524947 EXPECTED RESULT The value of the result in the calculator mode should be -1.25992105 so the result given was wrong both in the absolute value and in the sign. The correct function plotted in the 2D plot should have been an odd function and for x < 0 should be negative SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: Fedora 30 (available in About System) KDE Plasma Version: 5.15.5 KDE Frameworks Version: 5.59.0 Qt Version: 5.12.1 ADDITIONAL INFORMATION
(-2)^(1/3) isn't mathematically defined. What you want is -(2^(1/3)).
Actually, a^b with a < 0 and b not integral usually gives a complex number. It's possible that the code just doesn't handle this.
(In reply to Christoph Feck from comment #1) > (-2)^(1/3) isn't mathematically defined. What you want is -(2^(1/3)). This is actually not true. Given an odd function f(x)=xⁿ, n an odd integer or n a fraction a/b with b an odd integer, implies f(-x)=-f(x) ∀x in the domain of f. Hence saying "(-2)^(1/3) is -(2^(1/3))" does not add any further information to what the definition already says. With regard to the calculator only, do you think is possible for kalgebra to use such a property to correctly & easily compute xⁿ for x<0?
(In reply to Christoph Feck from comment #2) > Actually, a^b with a < 0 and b not integral usually gives a complex number. > It's possible that the code just doesn't handle this. Sorry man, this isn't true either. Even thinking of the Complex set, you'd have that the cubic root of a negative Real number (that is, a complex of argument π) has 3 solutions, each 120° or 2π/3 from the others. In other words, √³(-x), x>0, has 3 solutions in C, one at π/3, one at π/3+2π/3=π, the last at 5π/3. The one at π clearly representing a negative Real number. That has to be the solution to your problem, if you consider the problem from a C prospective. Considering the Real set as well, an odd function always accepts negative arguments because of the very definition of odd function.
It seems to be duplicate of https://bugs.kde.org/show_bug.cgi?id=402637.
I'm having a similar problem. y=3*x^2+6 and y=2*x^2+6 both plot as expected. But y=1*(x^2+2), y=2*(x^2+2), y=3*(x^2+2) and y=4*(x^2+2) all plot incorrectly and overlap - showing the same result. So if I expand the parentheses, they are correct, and if I leave kalgebra to do BODMAS, it fails. There may be some undocumented limitation in using parentheses.