| 1 | initial version |
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
| 2 | No.2 Revision |
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.
| 3 | No.3 Revision |
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.
| 4 | No.4 Revision |
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.
| 5 | No.5 Revision |
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
| 6 | No.6 Revision |
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).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.