Skip to content

Instantly share code, notes, and snippets.

@lukaskollmer
Created January 22, 2019 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukaskollmer/2a75c7c6164a97595bf1c12059aa7dfc to your computer and use it in GitHub Desktop.
Save lukaskollmer/2a75c7c6164a97595bf1c12059aa7dfc to your computer and use it in GitHub Desktop.
def f(x, y):
return (x-y, x+y)
def test(x, y):
(x_, y_) = f(x, y)
print(f"f({x}, {y}) = ({x_}, {y_})")
def F(x, y):
middle = (x + y) / 2
distance = middle - x
return (middle, distance)
# 0.25, -12
test((0.25+-12)/2, -6.125)
test(*F(0.25, 12))
test(*F(0.25, -12))
test(*F(-0.25, 12))
test(*F(-0.25, -12))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment