Solve example on various calculators - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not remotely HP Calculators (/forum-9.html) +--- Thread: Solve example on various calculators (/thread-20961.html) Solve example on various calculators - lrdheat - 12-09-2023 02:38 AM (X+1)*sqrt(X^2 -2*X -1) =0 on HP 35S, the roots at -1, ~-.41 are found. The root at ~2.41 produces a negative square root error. A similar experience on the TI-30X Pro…the ~2.41 root produces a no sign change error. The CASIO 991CW finds the ~2.41 root with ease, but the guess for the root at ~-.41 has to be correct to about 6 significant digits to find the root. The CASIO 9750giii has the same problem in the equation app, but finds the -1 and ~-.41 roots in calculate mode using SolveN and the Solve for a range of 2 to 3 finds the ~2.41 root ( a range encompassing the full range of roots only finds the ~2.41 root). Wonder how the methodologies differ amongst the calculators. RE: Solve example on various calculators - Albert Chan - 12-09-2023 01:19 PM Cas> zeros((x+1) * sqrt(x*x-2*x-1)) [-1, √2+1, -√2+1] By hand: f = (x+1) * sqrt(x*x-2*x-1) ln(f) = ln(x+1) + 1/2 * ln(x*x-2*x-1) f'/f   = 1/(x+1) + (x-1)/(x*x-2*x-1) = 1/(x+1) + 1/((x-1) - 2/(x-1)) f'/f is rational polynomial, without sqrt. f = 0      → f'/f = ±∞      → x = -1, 1±√2 RE: Solve example on various calculators - lrdheat - 12-09-2023 03:04 PM Hi Albert, I understand solving by hand, and CAS solutions. I was curious about what might be underpinning the differing behavior of these non CAS calculators with this problem. RE: Solve example on various calculators - C.Ret - 12-09-2023 06:19 PM (12-09-2023 02:38 AM)lrdheat Wrote:  A similar experience on the TI-30X Pro…the ~2.41 root produces a no sign change error. I have a different experience with a recently acquired Ti-30X PRO MathPrint calculator: Of course, I must admit that I used a technique which comes as close as possible (on a Ti-30X Pro MathPrint calculator) to a symbolic method. Because I don't think we can deduce anything from the operation of a numerical method with a function that is not defined, continuous and differentiable on either side of each root. I have no idea what methods each of the listed calculators use. But I don't know of any numerical roots finding method that works without the function being defined, continuous and differentiable on either side of each root. RE: Solve example on various calculators - lrdheat - 12-09-2023 07:24 PM Nice! Did not recognize that this would work for this class of problem! RE: Solve example on various calculators - Marco Polo - 12-09-2023 10:08 PM Maybe I am doing something wrong, but I could not get any other result but -1 on Plus42. On 50g SOLVEVX gives all three roots RE: Solve example on various calculators - C.Ret - 12-10-2023 03:19 AM I have only had my Ti-30X PRO for less than ten days and I discovered this astonishing calculator which is neither graphic, nor programmable nor CAS. But very well made, the only criticism is its screen which seems a little small to me compared to those to which I have become accustomed. A CAS machine allows us to understand what is happening here and provides a way to obtain the three solutions using a polynomial resolution module. In blue the plot of the function $$f(x)=(x+1)\times\sqrt{x^2-2x-1}$$. This function is the product of two polynomials, the second of which is under a square root: $$f(x)=(x+1)\times\sqrt{p(x)}$$ The pale yellow area is the region where the function f(x) is not defined, because the polynomial $$p(x)=x^2-2x-1$$ under the radical gives a negative value $$p(x)<0$$. As $$√(p(x))=0$$ is possible if and only if $$p(x)=0$$, the roots of $$f(x)$$ are the same as the roots of the polynomial $$g(x)=(x+1)(x ^2-2x-1)$$ whose trace is in red on the figure. The polynomial $$g(x)=x^3-x^2-3x-1$$ is of the third degree and its three roots can be obtained with the POLY-SOLV module. These are the same roots as the line $$x+1$$ and the parabola $$x²-2x-1$$ whose traces are in green on the figure.That is to say, as Albert Chan already told us, the exact values of the roots are -1, 1-√2 and 1+√2. Like Irdhead when I use the numeric solver module (NUM-SOLV) I only get the roots -.41421 and 2.41421 by entering the exact guesses 1±√2 respectively. Other guesses inevitably lead to a No Sign Change Error. I observe the same thing on my NUMWORKS which also can only find the three roots using the degree 3 polynomial trick and cannot numerically find the roots 1±√2 with its general equation solver when the radical is used. All this seems completely natural to me, I do not know of any numerical root resolution algorithm which does not need the function to be defined, continuous or differentiable on either side of each root. RE: Solve example on various calculators - lrdheat - 12-10-2023 04:32 AM I am wondering why the SolveN and Solve on the non CAS CASIO 9750giii manage to produce all 3 results, SolveN the -1 and -.41… roots, Solve the 2.41… roots. The TI 30X MathPrint is a nice calculator. I discovered that the max( and min( commands can be used in a function in an integration such as Integral from 0 to pi/4 of (max( sin (x), cos (x)). Pretty neat! By the way, the polynomial method works on the CASIO 991CW as well, and the more fancy CASIO’s! I like how the TI retains the history when turned off. The 991CW loses it’s history but retains statistics data. RE: Solve example on various calculators - carey - 12-10-2023 09:27 AM (12-10-2023 04:32 AM)lrdheat Wrote:  The CASIO 9750giii has the same problem in the equation app, but finds the -1 and ~-.41 roots in calculate mode using SolveN and the Solve for a range of 2 to 3 finds the ~2.41 root ( a range encompassing the full range of roots only finds the ~2.41 root). I am wondering why the SolveN and Solve on the non CAS CASIO 9750giii manage to produce all 3 results, SolveN the -1 and -.41… roots, Solve the 2.41… roots. Just speculating, but two possibilities come to mind: 1) The range cited (2 to 3) does not encompass the full range of roots -- only the 2.41 root. The range -2 to 3 would encompass the full range of roots. 2) Since Newton's Method can fail (either slow convergence or not at all) if the initial guess or an iterate is near f'(x) = 0 (because the line never intersects the x-axis), the 2.41 root is found using Solve as it is well away from f'(x) = 0, but the other two roots are near the local maximum where f'(x) = 0, so it becomes possible that an iterate occurs near f'(x)=0. Thank you for this interesting thread! RE: Solve example on various calculators - lrdheat - 12-10-2023 02:28 PM Solve from -2 to 3 only returned the ~2.41 root! RE: Solve example on various calculators - Albert Chan - 12-10-2023 04:05 PM (12-09-2023 06:19 PM)C.Ret Wrote:  I have no idea what methods each of the listed calculators use. But I don't know of any numerical roots finding method that works without the function being defined, continuous and differentiable on either side of each root. We may be able to get root with 1-sided convergence. OP problem (root 1-√2), plain Newton's method won't work. With shape like "╮", it will overshoot to bad region, inside 1±√2. But, if we do 3-points quadratic fit for root, it may work. lua> S = require'solver' lua> f = fn'x: (x+1) * sqrt(x*x-2*x-1)' lua> x = S.secant2(f, -0.4145, -0.4144, 1e-12, true, -0.4143) -0.4145 -0.4144 -0.4143 -0.41421382517725713 -0.4142135670509061 -0.41421356238295287 -0.41421356237309526 -0.41421356237309503 lua> f(x) 0 Another way is what I called signed sqrt trick, as long as it does not change the roots. Bad region now not only is defined, but also with sign reversal. This allowed iterations to spiral to true roots, without using complex numbers. For OP example, this is silly, but the trick may be useful elsewhere. 10 DEF FNS(X)=SGN(X)*SQRT(ABS(X)) 20 DEF FNF(X)=(X+1)*FNS(X*X-2*X-1) 30 INPUT "A,B=";A,B 40 DISP FNROOT(A,B,FNF(FVAR)) @ GOTO 30 >run A,B=-3,-.5 -1 A,B=-.5,.5 -.414213562375 A,B=.5,3 2.41421356238 RE: Solve example on various calculators - Gene222 - 12-12-2023 04:21 PM (12-10-2023 03:19 AM)C.Ret Wrote:  All this seems completely natural to me, I do not know of any numerical root resolution algorithm which does not need the function to be defined, continuous or differentiable on either side of each root. If you rewrite the equation as y = (x+1) * sqrt(x^2 - 2*x -1), the gap in y from -0.41 to 2.41 is caused because y is an imaginary number. This probably means that the numeric root solver or algorithm is capable of handling complex and imaginary numbers.