Post Reply 
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
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?
Find all posts by this user
Quote this message in a reply
10-21-2019, 08:08 PM
Post: #2
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.
Find all posts by this user
Quote this message in a reply
10-22-2019, 01:48 AM
Post: #3
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.
Find all posts by this user
Quote this message in a reply
10-22-2019, 09:15 AM
Post: #4
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?
Find all posts by this user
Quote this message in a reply
10-22-2019, 02:57 PM
Post: #5
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...
Find all posts by this user
Quote this message in a reply
10-22-2019, 07:11 PM
Post: #6
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:

[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
Find all posts by this user
Quote this message in a reply
10-22-2019, 10:33 PM (This post was last modified: 10-23-2019 09:05 PM by Joe Horn.)
Post: #7
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:

[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

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-23-2019, 04:05 AM
Post: #8
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?
Find all posts by this user
Quote this message in a reply
10-23-2019, 04:10 AM
Post: #9
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.
Find all posts by this user
Quote this message in a reply
10-23-2019, 08:36 AM
Post: #10
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.
Find all posts by this user
Quote this message in a reply
10-23-2019, 11:45 AM
Post: #11
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?
Find all posts by this user
Quote this message in a reply
10-23-2019, 12:08 PM
Post: #12
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:

[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!
Find all posts by this user
Quote this message in a reply
10-23-2019, 05:44 PM
Post: #13
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...
Find all posts by this user
Quote this message in a reply
10-23-2019, 05:46 PM
Post: #14
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
Find all posts by this user
Quote this message in a reply
10-23-2019, 05:56 PM
Post: #15
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).
Find all posts by this user
Quote this message in a reply
10-23-2019, 06:03 PM
Post: #16
RE: factor(x^4+1) and partfrac(1/(x^4+1))
Try this:

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

with standard CAS settings

-road
Find all posts by this user
Quote this message in a reply
10-23-2019, 06:03 PM
Post: #17
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).
Your variant with +1. instead of +1 is very helpful.
Find all posts by this user
Quote this message in a reply
10-23-2019, 06:06 PM
Post: #18
RE: factor(x^4+1) and partfrac(1/(x^4+1))
and this:

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

-road
Find all posts by this user
Quote this message in a reply
10-23-2019, 06:07 PM
Post: #19
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

-road
it works!
fine, but how did you find this syntax?
Find all posts by this user
Quote this message in a reply
10-23-2019, 07:15 PM
Post: #20
RE: factor(x^4+1) and partfrac(1/(x^4+1))
XCAS

-road
Find all posts by this user
Quote this message in a reply
Post Reply 




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