HP Forums
factor(x^4+1) and partfrac(1/(x^4+1)) - 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: factor(x^4+1) and partfrac(1/(x^4+1)) (/thread-13832.html)

Pages: 1 2


factor(x^4+1) and partfrac(1/(x^4+1)) - rombva - 10-21-2019 02:05 PM

HP Prime G2 (SW Ver 2.1.14181, CAS Ver 1.4.9) can't factorize the expression x^4+1. It returns this expression unchanged.

Also, partfrac(1/(x^4+1)) can't return partial fractions.

Is it a bug or a desired feature?


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - goetz - 10-21-2019 08:08 PM

x^4+1 has complex roots only. Go to the CAS settings and tick the setting "use i".

Then both commands will yield the factorization and partial factorization respectively.


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - Tim Wessman - 10-22-2019 01:48 AM

cfactor
cpartfrac


There are specific commands for doing a complex factorization when not in complex mode. Generally, I recommend leaving the CAS settings as default and using the complex only versions only when you want.


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - rombva - 10-22-2019 09:15 AM

I check out the tests from the document provided by link.

x^4+1=((x-(1-i)/sqrt(2))*(x-(1+i)/sqrt(2)))*((x-(-1-i)/sqrt(2))*(x-(-1+i)/sqrt(2)))=
=(x^2-sqrt(2)*x+1)*(x^2+sqrt(2)*x+1)

I don't want to get a factorization result over the complex field. The polynomial x^4+1 may be rewriten as a product of polynomials over the field of reals (for example, HP 50g can factorize it). What's wrong with HP Prime's factorization in the real mode in this case?


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - parisse - 10-22-2019 02:57 PM

Factorisation is done on the smallest field containing the coefficients. Inside Xcas, you can explicitly add algebraic extensions of Q like this
partfrac(1/(x^4+1),sqrt(2))
This will probably be available in the HP Prime in a future firmware...


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - Aries - 10-22-2019 07:11 PM

(10-21-2019 02:05 PM)rombva Wrote:  HP Prime G2 (SW Ver 2.1.14181, CAS Ver 1.4.9) can't factorize the expression x^4+1. It returns this expression unchanged.

Also, partfrac(1/(x^4+1)) can't return partial fractions.

Is it a bug or a desired feature?

From my experience with TI calcs, the TI-Nspire CAS attempts to factor/expand any expression with linear, rational and real factors, the expression shown is not factorable based on these conditions:

[Image: factorin.jpg]

By specifying a variable, Nspire CAS is able to produce linear factors, as long as these factors contain only real numbers.

[Image: expand.jpg]

Some polynomials are prime but, by specifying you want to factor in terms of x, you make sure Nspire produces linear factors (with approximations of irrational numbers).
Using propfrac:

[Image: propfrac.jpg]

I don't know if this applies to HP Prime, it's just a shot in the dark.
Best,

Aries Wink


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - Joe Horn - 10-22-2019 10:33 PM

(10-22-2019 09:15 AM)rombva Wrote:  I don't want to get a factorization result over the complex field. The polynomial x^4+1 may be rewriten as a product of polynomials over the field of reals (for example, HP 50g can factorize it). What's wrong with HP Prime's factorization in the real mode in this case?

Check your CAS settings. Near the bottom of the first page, in the left column, the second item is "Use square roots to factor polynomials". When that's turned on (the default setting), it yields the result you want:

[Image: factor.png]

EDIT: Oops! You're right: The recent publicly released firmware versions return x^4+1 unchanged. The above screen shot was apparently from a different firmware version, possibly a beta version which didn't say "BETA" in the top corner. My mistake. Sorry! Blush


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - rombva - 10-23-2019 04:05 AM

(10-22-2019 02:57 PM)parisse Wrote:  Factorisation is done on the smallest field containing the coefficients. Inside Xcas, you can explicitly add algebraic extensions of Q like this
partfrac(1/(x^4+1),sqrt(2))
This will probably be available in the HP Prime in a future firmware...

How to find out the elements for algebraic extensions that provide factorization?


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - rombva - 10-23-2019 04:10 AM

(10-22-2019 10:33 PM)Joe Horn Wrote:  ...
Check your CAS settings. Near the bottom of the first page, in the left column, the second item is "Use square roots to factor polynomials". When that's turned on (the default setting), it yields the result you want:
...

With default settings I get the input polynomial.


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - parisse - 10-23-2019 08:36 AM

(10-23-2019 04:05 AM)rombva Wrote:  How to find out the elements for algebraic extensions that provide factorization?

With solve.


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - rombva - 10-23-2019 11:45 AM

(10-23-2019 08:36 AM)parisse Wrote:  
(10-23-2019 04:05 AM)rombva Wrote:  How to find out the elements for algebraic extensions that provide factorization?

With solve.

factor(x^4+1,lvar(cSolve(x^4+1=0,x))) works fine.

For some polynomyals factor(f(x),lvar(cSolve(f(x)=0,x))) does nothing, for example, factor(x^7+2,lvar(cSolve(x^7+2=0,x))).

For some polynomyals factor(f(x),lvar(cSolve(f(x)=0,x))) doesn't return complete factorization, for example, factor(x^7+1,lvar(cSolve(x^7+1=0,x))).

For other polynomials the result contains a rootof([[][]]), for example, factor(x^5+2,lvar(cSolve(x^5+2=0,x))).

How to find out the elements for algebraic extensions that provide factorization? How to get factorization for these cases?


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - Thomas_Sch - 10-23-2019 12:08 PM

(10-22-2019 10:33 PM)Joe Horn Wrote:  
(10-22-2019 09:15 AM)rombva Wrote:  I don't want to get a factorization result over the complex field. The polynomial x^4+1 may be rewriten as a product of polynomials over the field of reals (for example, HP 50g can factorize it). What's wrong with HP Prime's factorization in the real mode in this case?

Check your CAS settings. Near the bottom of the first page, in the left column, the second item is "Use square roots to factor polynomials". When that's turned on (the default setting), it yields the result you want:

[Image: factor.png]

Hello Joe,
can you please post your other settings? (CAS and Home)
I get only the expression unchanged, like user rombva,
no matter what settings I make.
Many thanks in advance!


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - lrdheat - 10-23-2019 05:44 PM

I am in the same boat. When I put a decimal point after the 1, I get the desired approximation, but cannot get the exact result with a square root symbol...


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - lrdheat - 10-23-2019 05:46 PM

I have all the choices in CAS settings on left checked, everything on the right unchecked. This on G2 2.0.0.13865 OS V2.060.650


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - parisse - 10-23-2019 05:56 PM

to rombva: I was not clear enough. solve will help you find some algebraic extensions of Q (mainly sqrt()) but it will not help split every polynomial.
x^7+1 can be split with one rootof,
factor(x^7+1,rootof(x^6-x^5+x^4-x^3+x^2-x+1))
but that's not the generic case: in degree n, the extension may be of order n! and that would be too complicated even for small degrees.
You always have the option to do numeric factorization, like this
cfactor(x^7+1.0) (over C) or factor(x^7+1.0) (over R).


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - roadrunner - 10-23-2019 06:03 PM

Try this:

factor(x^4+1,sqrt(2))

with standard CAS settings

-road


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - Thomas_Sch - 10-23-2019 06:03 PM

(10-23-2019 05:46 PM)lrdheat Wrote:  I have all the choices in CAS settings on left checked, everything on the right unchecked. This on G2 2.0.0.13865 OS V2.060.650
same here,
on G1 (Hardware C), also on G2 (Hardware D, SW: 2.1.14181).
Your variant with +1. instead of +1 is very helpful.


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - roadrunner - 10-23-2019 06:06 PM

and this:

cfactor(x^4+1,sqrt(2))

-road


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - Thomas_Sch - 10-23-2019 06:07 PM

(10-23-2019 06:03 PM)roadrunner Wrote:  Try this:

factor(x^4+1,sqrt(2))

with standard CAS settings

-road
it works!
fine, but how did you find this syntax?


RE: factor(x^4+1) and partfrac(1/(x^4+1)) - roadrunner - 10-23-2019 07:15 PM

XCAS

-road