problems when using degree on indeterminates with indices

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

problems when using degree on indeterminates with indices

Message par jocaps » lun. janv. 01, 2018 9:04 pm

Hi,

I noticed the following problem

Code : Tout sélectionner

from giacpy import degree
degree("x1**2")
degree("x**2")
The first will return 0, the second will return 2. Although giac recognizes the expressions properly i.e. when doing arithmetic the indeterminate x1 will behave as it should. This behaviour also exists in Xcas. Any ideas or suggestion (except suggesting me to change the variable name not to have indices, because arithmetic is absolutely fine with the indices).

Edit: It seems giac believes that "x1" is of another type. For instance using e2r(x1**2) will not return the expected result. This is problematic for me.

Edit2: It seems I misunderstood degree? For a multivariate polynomial it does not take the total degree. Does it regard a multivariate polynomial as a univariate polynomial choosing a particular indeterminate? (and how does it choose this?). For instance degree(x*y) will return 1. Do I need to write my own code finding total degree? I also figured degree(x1**2,x1) does work

Jose

parisse
Messages : 5082
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: problems when using degree on indeterminates with indice

Message par parisse » mar. janv. 02, 2018 11:50 am

By default degree returns the degree wrt x, otherwise you must pass a second argument, for example degree(x1**2,x1)

Répondre