First time here? Check out the FAQ!
asked 1 year ago
var('r') 2r^2
outputs 4
Why is that?
Please check the types in the following code:
print("Before var:",type(r)) var('r') print("After var:",type(r)) print("2r^2:",2r^2) print("type(2r):",type(2r)) print("type(2*r):",type(2*r)) print("2*r^2:",2*r^2) print("(2*r)^2",(2*r)^2)
to multiply, you need *
*
Duplicate of https://ask.sagemath.org/question/75093/
I found the fact that 2r^2 was accepted extremely intriguing, and queried for it. John Palmieri's insightful answer pointed me to a feature of the preparser that I ignored after years of using Sage...
2r^2
answered 1 year ago
Try the following code, notice the "*" I added:
var('r') 2*r^2
I hope its what you want GPN
subscribe to rss feed
Asked: 1 year ago
Seen: 243 times
Last updated: Dec 24 '23
Please check the types in the following code:
to multiply, you need
*
Duplicate of https://ask.sagemath.org/question/75093/
I found the fact that
2r^2
was accepted extremely intriguing, and queried for it. John Palmieri's insightful answer pointed me to a feature of the preparser that I ignored after years of using Sage...