|
From: Richard F. <fa...@gm...> - 2025-11-15 18:45:22
|
Consider d: sqrt(c^2-2*c+1)-c+1. radcan(d) produces 0. notice that (1-c)^2 = (c-1)^2= c^2-2*c+1 d, c=4 returns 0, confirming that result from radcan(). d,c=-4 returns 10, contradicting that result. (read up about radcan... ) integrate(1/d,c) gives quotient by zero. integrate(d,c) gives a large expression E, radcan(E) produces 1/2. [ integrate(0,c) produces 0, differs by a constant so it is also OK] What's going on here? 1. There are two different square roots. Maxima's radcan() will choose one, if forced to do so. 2. Division by zero is sometimes concealed initially, but some operations (like integration, radcan) reveal it. 3. There are features in Maxima to support computation with algebraic integers. See tellrat(). 4. You may also encounter situations where Maxima gives a result for sqrt() involving abs. For example sqrt((1-k)^2) returns |k-1|. I think this is a bug, others think it is a feature. 5. If you really want to compute with algebraic numbers, try to give them names, say a1, a2, ... and compute with those names. You can also use tellrat() and algebraic:true to control the simplification. Just typing in sqrt(), or more generally E^(p/q) for rational p/q, suggests that you have something in mind, but probably have not conveyed that understanding to Maxima. A bit of thought. You may think it is obvious that 1^(1/8) is 1. Indeed, if you solve (y=1^(1/8),y) you get y=1. But solve(y^8=1,1) gives 8 solutions. One is y=1. This is not the most general solution. The full set is [y=(sqrt(2)*%i+sqrt(2))/2, y=%i, y=(sqrt(2)*%i-sqrt(2))/2, y=-1, y=-((sqrt(2)*%i+sqrt(2))/2), y=-%i, y=-((sqrt(2)*%i-sqrt(2))/2), y=1] Choosing the first gives you more generality, as y^2, y^3, ... cycle through the roots. All this is not to say you must know so much about algebra, but it sometimes happens that the answer to a relatively simple question that can be posed in elementary algebra involves more advanced math. Imagine someone who has not yet learned about complex numbers asking Maxima sqrt(-1), and not understanding the result... pointing out that the numerical math library gives an error message, not %i. Rjf |