-2

This is really odd, not much to say about it.

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.5, Release Date: 2018-12-22                     │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘

-t

Sebastiano
  • 7,649
  • Are you sure this question wouldn't be better answered in another SE? –  Jan 19 '19 at 04:06
  • @AniruddhVenkatesan Where would you recommend? – Louis Hong Jan 19 '19 at 04:07
  • That depends on what type of answer you're looking for. If you're looking for a reason as to why Python respond and return this result, Stack Overflow might be a better choice. If you want a mathematical explanation, then I would suggest leaving the question on this site and trying to see if someone knows the answer –  Jan 19 '19 at 04:11
  • 4
    What is "odd" about this? Do you have reason to doubt the result? What result did you expect and why? – JMoravitz Jan 19 '19 at 04:15

2 Answers2

1

This is just basic algebra, namely laws of exponents:

$(t-1)^2 = (-1(1-t))^2= (-1)^2(1-t)^2 = (1-t)^2$

Randall
  • 18,542
  • 2
  • 24
  • 47
1

Forget $1-t$. Instead, think $T$. Is it so surprising/odd that $$(T)^2 = (-T)^2$$ ?

Alternatively we can expand them:

$$(1-t)(1-t)=(1)(1) +(2)(1)(-t)+(-t)(-t)=1-2t+t^2$$

$$(t-1)(t-1)=(t)(t)+2(-1)(t)+(-1)(-1)=t^2-2t+1$$

Rhys Hughes
  • 12,842