factor(x^4+1) and partfrac(1/(x^4+1))
10-21-2019, 02:05 PM (This post was last modified: 10-21-2019 04:23 PM by rombva.)
Post: #1
 rombva Junior Member Posts: 38 Joined: Oct 2019
factor(x^4+1) and partfrac(1/(x^4+1))
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?
10-21-2019, 08:08 PM
Post: #2
 goetz Junior Member Posts: 33 Joined: Feb 2018
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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.
10-22-2019, 01:48 AM
Post: #3
 Tim Wessman Senior Member Posts: 2,293 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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.

TW

Although I work for HP, the views and opinions I post here are my own.
10-22-2019, 09:15 AM
Post: #4
 rombva Junior Member Posts: 38 Joined: Oct 2019
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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?
10-22-2019, 02:57 PM
Post: #5
 parisse Senior Member Posts: 1,327 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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...
10-22-2019, 07:11 PM
Post: #6
 Aries Member Posts: 159 Joined: Oct 2014
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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:

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

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:

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

Aries
10-22-2019, 10:33 PM (This post was last modified: 10-23-2019 09:05 PM by Joe Horn.)
Post: #7
 Joe Horn Senior Member Posts: 2,011 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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:

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!

<0|ΙΈ|0>
-Joe-
10-23-2019, 04:05 AM
Post: #8
 rombva Junior Member Posts: 38 Joined: Oct 2019
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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?
10-23-2019, 04:10 AM
Post: #9
 rombva Junior Member Posts: 38 Joined: Oct 2019
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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.
10-23-2019, 08:36 AM
Post: #10
 parisse Senior Member Posts: 1,327 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(10-23-2019 04:05 AM)rombva Wrote:  How to find out the elements for algebraic extensions that provide factorization?

With solve.
10-23-2019, 11:45 AM
Post: #11
 rombva Junior Member Posts: 38 Joined: Oct 2019
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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?
10-23-2019, 12:08 PM
Post: #12
 Thomas_Sch Senior Member Posts: 411 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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:

Hello Joe,
I get only the expression unchanged, like user rombva,
no matter what settings I make.
10-23-2019, 05:44 PM
Post: #13
 lrdheat Senior Member Posts: 869 Joined: Feb 2014
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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...
10-23-2019, 05:46 PM
Post: #14
 lrdheat Senior Member Posts: 869 Joined: Feb 2014
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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
10-23-2019, 05:56 PM
Post: #15
 parisse Senior Member Posts: 1,327 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
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).
10-23-2019, 06:03 PM
Post: #16
 roadrunner Senior Member Posts: 448 Joined: Jun 2015
RE: factor(x^4+1) and partfrac(1/(x^4+1))
Try this:

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

with standard CAS settings

10-23-2019, 06:03 PM
Post: #17
 Thomas_Sch Senior Member Posts: 411 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(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).
10-23-2019, 06:06 PM
Post: #18
 roadrunner Senior Member Posts: 448 Joined: Jun 2015
RE: factor(x^4+1) and partfrac(1/(x^4+1))
and this:

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

10-23-2019, 06:07 PM
Post: #19
 Thomas_Sch Senior Member Posts: 411 Joined: Dec 2013
RE: factor(x^4+1) and partfrac(1/(x^4+1))
(10-23-2019 06:03 PM)roadrunner Wrote:  Try this:

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

with standard CAS settings

it works!
fine, but how did you find this syntax?
10-23-2019, 07:15 PM
Post: #20
 roadrunner Senior Member Posts: 448 Joined: Jun 2015
RE: factor(x^4+1) and partfrac(1/(x^4+1))
XCAS