Ask Your Question

Revision history [back]

Your question is unclear, since for symbolic function, ^ stantds for the exponentiation, not logic and. What is the meaning of ^ in your case ? Which kind of output object do you expect ? Do you want to plug it in another software (Sage does not handle logic formula very well) ? If you want strings, you can do:

sage: var('x0,x1')
(x0, x1)
sage: a = (x0 + x1) ; a
x0 + x1
sage: SR(str(a).replace('+','^'))
x0^x1

Your question is unclear, since for symbolic function, ^ stantds for the exponentiation, not logic and. What is the meaning of ^ in your case ? Which kind of output object do you expect ? Do you want to plug it in another software (Sage does not handle logic formula very well) ? If you want strings, you can do:

sage: var('x0,x1')
(x0, x1)
sage: a = (x0 + x1) ; a
x0 + x1
sage: SR(str(a).replace('+','^'))
x0^x1

But priorities of ^ with respect to * is not the same as the one of + with *, so you need to be careful with that.

Your question is unclear, since for symbolic function, ^ stantds for the exponentiation, not logic and. What is the meaning of ^ in your case ? Which kind of output object do you expect ? Do you want to plug it in another software (Sage does not handle logic formula very well) ? If you want strings, you can do:

sage: var('x0,x1')
(x0, x1)
sage: a = (x0 + x1) ; a
x0 + x1
sage: SR(str(a).replace('+','^'))
str(a).replace('+','^')
x0^x1

But priorities of ^ with respect to * is not the same as the one of + with *, so you need to be careful with that.

Your question is unclear, since for symbolic function, ^ stantds for the exponentiation, not logic and. What is the meaning of ^ in your case ? Which kind of output object do you expect ? Do you want to plug it in another software (Sage does not handle logic formula very well) ? If you want strings, you can do:

sage: var('x0,x1')
(x0, x1)
sage: a = (x0 + x1) ; a
x0 + x1
sage: str(a).replace('+','^')
x0^x1
x0 ^ x1

But priorities of ^ with respect to * is not the same as the one of + with *, so you need to be careful with that.

Your question is unclear, since for symbolic function, ^ stantds stands for the exponentiation, not logic and. What is the meaning of ^ in your case ? Which kind of output object do you expect ? Do you want to plug it in another software (Sage does not handle logic formula very well) ? If you want strings, you can do:

sage: var('x0,x1')
(x0, x1)
sage: a = (x0 + x1) ; a
x0 + x1
sage: str(a).replace('+','^')
x0 ^ x1

But priorities of ^ with respect to * is not the same as the one of + with *, so you need to be careful with that.

If you want the result to be a symbolic expression and ^ be the exponentiation, and respect priority of operations despite possibily missing parentheses, you will have to use https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression_conversions.html

Your question is unclear, since for symbolic function, ^ stands for the exponentiation, not logic and. What is the meaning of ^ in your case ? Which kind of output object do you expect ? Do you want to plug it in another software (Sage does not handle logic formula very well) ? If you want strings, you can do:

sage: var('x0,x1')
(x0, x1)
sage: a = (x0 + x1) ; a
x0 + x1
sage: str(a).replace('+','^')
x0 ^ x1

But priorities of ^ with respect to * is not the same as the one of + with *, so you need to be careful with that.

If you want the result to be a symbolic expression and ^ be the exponentiation, and respect priority of operations despite possibily missing parentheses, you will have to use https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression_conversions.htmlhttps://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression_conversions.html (but i won't write a dedicated code unless you makes your question more precise).