Ask Your Question

Revision history [back]

Problem with the minus sign in symbolic expression

Hi all!

In my code, I have a multivariate polynomial with a sign symbol which doesn't return the correct result. I.e.

The code snippet is as follows:

sage: f1=b1-a1.dot_product(x)

a1 is a vector with values (76, 83), b1 is scalar with value 62, x is a vector with values (x1,x2). Thus, f1 should return 62-76 * x1-83 * x2; however it returns 25x1 + 18x2 + 62 which is not correct.

Please note that if I use addition in f1 as follows:

sage: f1=b1+a1.dot_product(x)

The result is correct,i.e. 76x1 + 83x2 + 62

type(f1) is sage.symbolic.expression.Expression

What could the problem be? I tried to convert the symbolic expression to multivariate polynomial, but this didn't work either? I also though there might be a problem with the minus symbol in my PC but couldn't solve it this way either.

Thank you for your responses! Regards, Natassa

Problem with the minus sign in symbolic expression

Hi all!

My sage version is:

'SageMath Version 6.9, Release Date: 2015-10-10'

In my code, I have a multivariate polynomial with a sign symbol which doesn't return the correct result. I.e.

The code snippet is as follows:

sage: f1=b1-a1.dot_product(x)
follows: A1 = [(', '.join('x%i'%i for i in [1.. n]))]; ### construct a suitable multivariate ring V = var(A1[0]) ### define a str variable x=vector(list(V)) ### convert to vector f1=b1-a1.dot_product(x)

a1 and b1 are returned from another function.
types of a1 and x are different type(a1)=<type 'sage.modules.vector_modn_dense.vector_modn_dense'=""> type(x)= <class 'sage.modules.vector_symbolic_dense.freemodule_ambient_field_with_category.element_class'=""> Could this cause a problem?

a1 is a vector with values (76, 83), b1 is scalar with value 62, x is a vector with values (x1,x2). Thus, f1 should return 62-76 * x1-83 * x2; however it returns 25x1 + 18x2 + 62 which is not correct.

Please note that if I use addition in f1 as follows:

sage: f1=b1+a1.dot_product(x)

The result is correct,i.e. 76x1 + 83x2 + 62

type(f1) is sage.symbolic.expression.Expression

What could the problem be? I tried to convert the symbolic expression to multivariate polynomial, but this didn't work either? I also though there might be a problem with the minus symbol in my PC but couldn't solve it this way either.

Thank you for your responses! Regards, Natassa

Problem with the minus sign in symbolic expression

Hi all!

My sage version is:

'SageMath Version 6.9, Release Date: 2015-10-10'

In my code, I have a multivariate polynomial with a sign symbol which doesn't return the correct result. I.e.

The code snippet is as follows: follows:

A1 = [(', '.join('x%i'%i for i in [1.. n]))]; ### construct a suitable multivariate ring
  V = var(A1[0])                               ### define a str variable
 x=vector(list(V))                                 ### convert to vector
    f1=b1-a1.dot_product(x)  

f1=b1-a1.dot_product(x)

a1 and b1 are returned from another function.
types of a1 and x are different type(a1)=<type 'sage.modules.vector_modn_dense.vector_modn_dense'=""> type(x)= <class 'sage.modules.vector_symbolic_dense.freemodule_ambient_field_with_category.element_class'=""> Could this cause a problem?

a1 is a vector with values (76, 83), b1 is scalar with value 62, x is a vector with values (x1,x2). Thus, f1 should return 62-76 * x1-83 * x2; however it returns 25x1 + 18x2 + 62 which is not correct.

Please note that if I use addition in f1 as follows:

sage: f1=b1+a1.dot_product(x)

The result is correct,i.e. 76x1 + 83x2 + 62

type(f1) is sage.symbolic.expression.Expression

What could the problem be? I tried to convert the symbolic expression to multivariate polynomial, but this didn't work either? I also though there might be a problem with the minus symbol in my PC but couldn't solve it this way either.

Thank you for your responses! Regards, Natassa

Problem with the minus sign in symbolic expression

Hi all!

My sage version is:

'SageMath Version 6.9, Release Date: 2015-10-10'

In my code, I have a multivariate polynomial with a sign symbol which doesn't return the correct result. I.e.

The code snippet is as follows:

A1 = [(', '.join('x%i'%i for i in [1.. n]))]; ### construct a suitable multivariate ring
 V = var(A1[0])                               ### define a str variable
x=vector(list(V))                                 ### convert to vector
f1=b1-a1.dot_product(x)

a1 and b1 are returned from another function.
types **types of a1 and x are different different:

type(a1)=<type 'sage.modules.vector_modn_dense.vector_modn_dense'=""> 'sage.modules.vector_modn_dense.vector_modn_dense'="">

type(x)=  <class 'sage.modules.vector_symbolic_dense.freemodule_ambient_field_with_category.element_class'="">
'sage.modules.vector_symbolic_dense.FreeModule_ambient_field_with_category.element_class'>

Could this cause a problem?problem?**

a1 is a vector with values (76, 83), b1 is scalar with value 62, x is a vector with values (x1,x2). Thus, f1 should return 62-76 * x1-83 * x2; however it returns 25x1 + 18x2 + 62 which is not correct.

Please note that if I use addition in f1 as follows:

sage: f1=b1+a1.dot_product(x)

The result is correct,i.e. 76x1 + 83x2 + 62

type(f1) is sage.symbolic.expression.Expression

What could the problem be? I tried to convert the symbolic expression to multivariate polynomial, but this didn't work either? I also though there might be a problem with the minus symbol in my PC but couldn't solve it this way either.

Thank you for your responses! Regards, Natassa

Problem with the minus sign in symbolic expression

Hi all!

My sage version is:

'SageMath Version 6.9, Release Date: 2015-10-10'

In my code, I have a multivariate polynomial with a sign symbol which doesn't return the correct result. I.e.

The code snippet is as follows:

A1 = [(', '.join('x%i'%i for i in [1.. n]))]; ### construct a suitable multivariate ring
 V = var(A1[0])                               ### define a str variable
x=vector(list(V))                                 ### convert to vector
f1=b1-a1.dot_product(x)

a1 and b1 are returned from another function.
**types types of a1 and x are different:

type(a1)=<type 'sage.modules.vector_modn_dense.vector_modn_dense'="">

type(x)=  <class 'sage.modules.vector_symbolic_dense.FreeModule_ambient_field_with_category.element_class'>

Could this cause a problem?**be a problem?

a1 is a vector with values (76, 83), b1 is scalar with value 62, x is a vector with values (x1,x2). Thus, f1 should return 62-76 * x1-83 * x2; however it returns 25x1 + 18x2 + 62 which is not correct.

Please note that if I use addition in f1 as follows:

sage: f1=b1+a1.dot_product(x)

The result is correct,i.e. 76x1 + 83x2 + 62

type(f1) is sage.symbolic.expression.Expression

What could the problem be? I tried to convert the symbolic expression to multivariate polynomial, but this didn't work either? I also though there might be a problem with the minus symbol in my PC but couldn't solve it this way either.

Thank you for your responses! Regards, Natassa

Problem with the minus sign in symbolic expression

Hi all!

My sage version is:

'SageMath Version 6.9, Release Date: 2015-10-10'

In my code, I have a multivariate polynomial with a sign symbol which doesn't return the correct result. I.e.

The code snippet is as follows:

A1 = [(', '.join('x%i'%i for i in [1.. n]))]; ### construct a suitable multivariate ring
 V = var(A1[0])                               ### define a str variable
x=vector(list(V))                                 ### convert to vector
f1=b1-a1.dot_product(x)

a1 and b1 are returned from another function.
types of a1 and x are different:

type(a1)=<type 'sage.modules.vector_modn_dense.vector_modn_dense'="">

 type(a1)=<type 'sage.modules.vector_modn_dense.Vector_modn_dense'>

type(x)=  <class 'sage.modules.vector_symbolic_dense.FreeModule_ambient_field_with_category.element_class'>

Could this be a problem?

a1 is a vector with values (76, 83), b1 is scalar with value 62, x is a vector with values (x1,x2). Thus, f1 should return 62-76 * x1-83 * x2; however it returns 25x1 + 18x2 + 62 which is not correct.

Please note that if I use addition in f1 as follows:

sage: f1=b1+a1.dot_product(x)

The result is correct,i.e. 76x1 + 83x2 + 62

type(f1) is sage.symbolic.expression.Expression

What could the problem be? I tried to convert the symbolic expression to multivariate polynomial, but this didn't work either? I also though there might be a problem with the minus symbol in my PC but couldn't solve it this way either.

Thank you for your responses! Regards, Natassa