HP Forums

Full Version: factor(x^4+1) and partfrac(1/(x^4+1))
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
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.
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.
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?
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-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
(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
(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-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 04:05 AM)rombva Wrote: [ -> ]How to find out the elements for algebraic extensions that provide factorization?

With solve.
(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-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!
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...
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
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).
Try this:

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

with standard CAS settings

-road
(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.
and this:

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

-road
(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?
XCAS

-road
Pages: 1 2
Reference URL's