Solving inequalities - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Solving inequalities ( /thread-19153.html) |

Solving inequalities - ftneek - 11-16-2022 10:45 AM
Hello, I was trying some problems from file:///Applications/Xcas.app/Contents/usr/bin/doc/en/tutoriel/tutoriel009.html when I think I came across a discrepancy when compared with the output of Wolfram alpha on exercise 8, specifically the third limit given and part 2 of the exercise. When I use the command Code: `solve(Abs[Limit[(1+1/x)^x,x->+∞]-(1+1/x)^x]<10^-3)` When I use cas on the hp prime, I only get one solution {x>1358.22430275} (Is there a way to copy a plain text representation of a calculation on my virtual calculator to my computer's clipboard? I'm using the most up to date version of the Mac version if it makes a difference) When I used Xcas on a Firefox browser, I get list[-254822177851,x>1358.22428235] The command I entered on Xcas is Code: `f(x):=(1+1/x)^x` Why does hp prime cas only return one interval? Why is the first solution by Xcas very small (although maybe technically correct)? By the way, when I change < to <=, Wolfram gives x<=-1360.06 or x>=1358.22, Xcas gives list[(x>=(-198574405166)) and (x<-1)] but hp prime cas gives [] no solution? And when I change < to just =, prime seems to match Wolfram alpha with x≈-1360.06 and x≈1358.22, but Xcas just gives list[1358.22430144]. Why don't the results from Xcas, prime, and Wolfram alpha all agree? If it's a bug, is there any chance of it being fixed in the future? Update: I just tried repeatedly executing the same expression on Xcas, and each time it gave a different result, cycling between [] no solution, 1 solution (around 1358), 2 solutions (correct) solutions, and a list of solutions (only 1 looks right). I just tried the same thing on my virtual calculator, copying the expression and evaluating it again, and it seems to cycle like Xcas. I'm using the most up to date version of the virtual calc for Mac, and will try testing on my physical prime tomorrow and give an update if the results are any different than the virtual. RE: Solving inequalities - parisse - 11-16-2022 07:25 PM
This equation can not be solved exactly, only numerically. First replace the limit with the value e then try with fsolve with an interval (for bisection). f(x):=(1+1/x)^x; l:=limit(f(x),x=+infinity); fsolve(abs(l-f(x))=1e-3,x=-2000..2000) RE: Solving inequalities - ftneek - 11-19-2022 01:24 AM
Thanks for the suggestion parisse. I have two questions related to this topic. 1. Once we have the results, is there a way to determine if x is less than or greater than? (I tried checking the value of e-f(1359) but get undef, and If I use the < sign in fsolve(), I don't get any result.) 2. Is there a way to get a reasonable estimate for the range of x values to try? If I'm forgetting simple math, my apologies. RE: Solving inequalities - parisse - 11-20-2022 06:57 PM
fsolve does not solve inequations. If I define f(x):=(1+1/x)^x-e, then f(1350.) is about -0.00100608 while f(1360.) is about -0.0009987 (beware that subtraction of 2 numbers close together will loose relative precision). You can find an approx idea of x by doing a series expansion at infinity series(f(x),x=inf) and replace f(x) by the first term, -e/2x, then solve -e/2x=-1e-3 RE: Solving inequalities - Albert Chan - 11-21-2022 03:33 PM
(11-16-2022 10:45 AM)ftneek Wrote: The command I entered on Xcas is Solver probably added some random elements to guess, thus getting different results. Negative solution is tougher, since f(x) = negative ^ negative = complex On XCas 1.5.0-63 (win32) (old version), I get different results, with repeated solve. [((x>1358.2242733) and (x<4.84957600044e+12))] [((x>1358.22427348) and (x<4.15614031773e+12))] [x>1358.22427318] [x>1358.22427339] [x<-1360.05760617,x>1358.22427263] I get the correct result on the fifth tries. The problem is ... we don't know which one to pick. On XCas 1.9.0-22 (win32) (new version), it crashes every time. On HP emulator Build 2.1.14181 (2018 10 16) (very old), surprisingly, I get good answer for every solve. I had never bother to upgrade {x<−1360.05760747,x>1358.22428117} {x<−1360.05761507,x>1358.22429144} {x<−1360.05760716,x>1358.22430358} {x<−1360.05761158,x>1358.22427617} {x<−1360.05761261,x>1358.22429356} Update Nov 22, 2022: I tried XCas 1.9.0 again. This time no crash, given similar result to XCas 1.5.0 |