Post Reply 
HP50g simplifing a root
10-04-2020, 11:48 PM (This post was last modified: 10-10-2020 05:23 PM by Albert Chan.)
Post: #11
RE: HP50g simplifing a root
(10-04-2020 06:05 PM)peacecalc Wrote:  I tried two way, the first was to probe every small a from 1 until third root of A. From your example a has to tested from 1 to 670, what a luck, that a = 99. My second approach is to calculate every divisor of A (with DIVI) as a possible candidate for small a. Then I'm calculate the difference A - third power of a. Negative results can be sorted out. The rest is divided by 3*k*a and be square rooted. If the result is a integer and not a algebraic expression would be a solution for smal b. and we get:

\[ \left( A\pm B\cdot\sqrt{k} \right)^{1/3} = a \pm b\cdot\sqrt{k} \]

Based on above description ... not really.

You are solving ³√(A ± B√k) = a ± √r

r = b²k = (A-a³)/(3a)       // note: no B's !

(I might be wrong, your code may have used B somewhere)

Here is my lua code, that checked b actually get to B
see https://www.hpmuseum.org/forum/thread-15...#pid136957

Code:
cbrt = require'mathx'.cbrt

function simp_cbrt1(A, B, k)         -- simplify cbrt(A + B * sqrt(k))
    local N = abs(A)
    for a = 1+(N-1)%3, cbrt(N), 3 do -- a mod 3 = A mod 3
        if N % a ~= 0 then continue end
        local r = (N/a - a*a)/3
        if r % k ~= 0 then continue end
        local b = B / (3*a*a+r)
        if r == b*b*k then return (A<0 and -a or a), b, k end
    end
end

lua> A, B, k = 1859814842094, -59687820010, 415
lua> simp_cbrt1(A,B,k)
11589      -145      415
lua> simp_cbrt1(A,B+1,k)      -- nothing returned
lua>

Update: added a ≡ A (mod 3), see https://www.hpmuseum.org/forum/thread-15...#pid137252
Update2: fixed a bug if A is negative
Update3: inspired by simp_cbrt2(), calculate b without square root (i.e. not from r = b²k)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP50g simplifing a root - peacecalc - 09-29-2020, 09:22 PM
RE: HP50g simplifing a root - Albert Chan - 09-29-2020, 11:47 PM
RE: HP50g simplifing a root - Albert Chan - 09-30-2020, 02:22 AM
RE: HP50g simplifing a root - Albert Chan - 09-30-2020, 10:50 PM
RE: HP50g simplifing a root - Albert Chan - 10-01-2020, 07:31 AM
RE: HP50g simplifing a root - peacecalc - 09-30-2020, 05:33 AM
RE: HP50g simplifing a root - peacecalc - 10-01-2020, 02:20 PM
RE: HP50g simplifing a root - Albert Chan - 10-01-2020, 05:22 PM
RE: HP50g simplifing a root - peacecalc - 10-04-2020, 06:05 PM
RE: HP50g simplifing a root - Albert Chan - 10-04-2020 11:48 PM
RE: HP50g simplifing a root - peacecalc - 10-04-2020, 07:36 PM
RE: HP50g simplifing a root - peacecalc - 10-05-2020, 11:36 AM
RE: HP50g simplifing a root - Albert Chan - 10-05-2020, 05:01 PM
RE: HP50g simplifing a root - peacecalc - 10-06-2020, 05:25 AM
RE: HP50g simplifing a root - Albert Chan - 10-06-2020, 09:40 AM
RE: HP50g simplifing a root - Albert Chan - 10-06-2020, 12:06 PM
RE: HP50g simplifing a root - Albert Chan - 10-06-2020, 04:13 PM
RE: HP50g simplifing a root - Albert Chan - 10-07-2020, 06:12 PM
RE: HP50g simplifing a root - Albert Chan - 10-09-2020, 12:20 AM
RE: HP50g simplifing a root - Albert Chan - 10-09-2020, 02:31 PM
RE: HP50g simplifing a root - Albert Chan - 10-11-2020, 06:28 PM
RE: HP50g simplifing a root - Albert Chan - 10-12-2020, 03:17 AM
RE: HP50g simplifing a root - Albert Chan - 10-24-2020, 02:19 PM
RE: HP50g simplifing a root - Albert Chan - 10-12-2020, 10:54 PM
RE: HP50g simplifing a root - CMarangon - 10-12-2020, 11:45 PM
RE: HP50g simplifing a root - grsbanks - 10-13-2020, 06:46 AM
RE: HP50g simplifing a root - Albert Chan - 10-09-2020, 05:21 PM
RE: HP50g simplifing a root - Albert Chan - 10-10-2020, 03:58 PM
RE: HP50g simplifing a root - Albert Chan - 10-10-2020, 04:49 PM
RE: HP50g simplifing a root - peacecalc - 10-12-2020, 08:49 PM
RE: HP50g simplifing a root - peacecalc - 10-13-2020, 06:30 AM
RE: HP50g simplifing a root - peacecalc - 10-13-2020, 06:36 AM



User(s) browsing this thread: 1 Guest(s)