11-19-2020, 04:12 PM (This post was last modified: 11-19-2020 10:00 PM by dah145.)
Post: #6
 dah145 Junior Member Posts: 37 Joined: Aug 2020
(11-03-2020 03:46 AM)dah145 Wrote:
(11-02-2020 07:32 PM)Albert Chan Wrote:  Hi, dah145

You can isolate the terms to be factorize, like this.

XCas> factor2(mess,s) := poly2symb(factor(symb2poly(mess,s)),s)

XCas> factor2(a^2 - 2*a*b + b^2 + s^2, a) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → b^2+s^2+a*(a-2*b)
XCas> factor2(a^2 - 2*a*b + b^2 + s^2, s) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → s^2+(a-b)^2

Yes thanks, this definitely is what I was looking for. Now I wonder if it is possible to obtain the expressions in form of a product, say: (a^2 - 2*a*b + b^2 + s^2)*(a^2 - 2*a*b + b^2 + s^2) = (s^2+(a-b)^2)*(s^2+(a-b)^2), as using your custom function outputs a not so friendly expression: s^2*(2*(a^2 + b^2) + s^2)+(a+b)^2*(a-b)^2.

Just wanted to update, I wrote a little program that factorizes polynomials to a more friendly expression than the built in factor function, I attached an example. A is the expression and B is the variable to factorize.

PHP Code:
#casfacto(A,B):=BEGINLOCAL fac, coe, pola, polb;fac:=factors(A);coe:={0};polb:=[0];FOR N FROM 1 TO SIZE(fac)/2 DOcoe[N]:=coeff(fac[2*N-1],B);END;pola:=factor(coe);FOR N FROM 1 TO SIZE(fac)/2 DOpolb[N]:=poly2symb(pola[N],B);END;RETURN regroup(product(polb[n]^(fac[2*n]),n,1,SIZE(polb)));END;#end

Attached File(s) Thumbnail(s)

 « Next Oldest | Next Newest »

 Messages In This Thread About HP Prime factorization - dah145 - 11-02-2020, 06:28 AM RE: About HP Prime factorization - parisse - 11-02-2020, 07:58 AM RE: About HP Prime factorization - dah145 - 11-02-2020, 05:40 PM RE: About HP Prime factorization - Albert Chan - 11-02-2020, 07:32 PM RE: About HP Prime factorization - dah145 - 11-03-2020, 03:46 AM RE: About HP Prime factorization - dah145 - 11-19-2020 04:12 PM

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