You should say which Sage version you are using, and also give the
complete code.  In Sage 7.4 I get this:

sage: var('x1','x2')
(x1, x2)
sage: a1=vector([76,83])
sage: b1=62
sage: x=vector([x1,x2])
sage: f1=b1-a1.dot_product(x)
sage: f1
-76*x1 - 83*x2 + 62

which looks good.  Perhaps you mistyped something?

John Cremona

On 8 December 2016 at 09:49, Anastasia Theodouli
<[email protected]> wrote:
> 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 **25*x1 + 18*x2 + 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. 76*x1 + 83*x2 + 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to