free software resistance
the cost of computing freedom is eternal vigilance
### maths.py
*original date:* oct 2015
*originally posted:* sep 2024
renamed from math to math.py for convenience, then to maths.py to avoid interfering with the pythons math module when running programs from the same folder.
cool program i originally wrote with basic, animates what looks a bit like a shoestring:
```
#!/usr/bin/env python
# coding: utf-8
# public domain
# mathknot
# aug 2012 (quite possibly earlier) menn
import curses
import time
import math
def m4th(knot):
while 1:
try:
m(knot)
except KeyboardInterrupt:
break
def m(knot):
v = 1
l = 0
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)
gr = curses.color_pair(1)
while v < 11:
knot.clear()
p = -3.1415
while p < 3.14159:
l += 1
if l == 361: l = 0
x = math.sin(math.cos(p * l / 20.0) * v) * 50 + 100
y = math.cos(math.sin(p * l / 20.0) * v) * 50 + 100
x1 = int(x / 2.0 - 10) #; knot.addstr(str(x1))
y1 = int(y / 5.0 - 9) #; knot.addstr(str(y1))
if y1 >= 1 and y1 <= 25:
if x1 >= 1 and x1 <= 80:
knot.addstr(y1, x1, " ", gr)
p += 1 / 300.0
knot.refresh()
time.sleep(.01)
v += .14
while v > 1:
knot.clear()
p = 3.1415
while p > -3.14159:
l -= 1
if l < 0: l = 360
x = math.sin(math.cos(p * l / 20.0) * v) * 50 + 100
y = math.cos(math.sin(p * l / 20.0) * v) * 50 + 100
x1 = int(x / 2.0 - 10) #; knot.addstr(str(x1))
y1 = int(y / 5.0 - 9) #; knot.addstr(str(y1))
if y1 >= 1 and y1 <= 25:
if x1 >= 1 and x1 <= 80:
knot.addstr(y1, x1, " ", gr)
p -= 1 / 300.0
knot.refresh()
time.sleep(.01)
v -= .14
curses.wrapper(m4th)
```
license: 0-clause bsd
```
# 2015 mn
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org