Ask Your Question
0

how to change logic symbols

asked 2019-10-10 18:01:22 +0200

anonymous user

Anonymous

I have (x0 + x1) and want to make (x0 ^ x1) Is there any functions which will help me do this ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-10-10 18:39:16 +0200

tmonteil gravatar image

updated 2019-10-10 18:46:54 +0200

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/refe... (but i won't write a dedicated code unless you makes your question more precise).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-10-10 18:01:22 +0200

Seen: 149 times

Last updated: Oct 10 '19