This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Kepler binary orbit plot, using eccentric anomaly | |
Written by PM 2Ring 2023.10.05 | |
""" | |
from functools import lru_cache | |
@lru_cache(int(3)) | |
def kepler(ec, N): | |
""" Solve Kepler's equation for N equal timesteps """ | |
out = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tensegrity twisted prism. PM 2Ring 2024.08.31 | |
def ball(radius, **kwargs): | |
var('u,v') | |
kw = dict(plot_points=40) | kwargs | |
return spherical_plot3d(radius, (u, 0, 2*pi), (v, 0, pi), **kw) | |
def axis_matrix(W): | |
a, b, c = W | |
if abs(c) == 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQE | |
CAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKC | |
gr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo | |
KCgoKCgoKCgoKCgoKCgoKCgr/wAARCACgAUADASIAAhEBAxEB/8QAHAABAAIDAQEBAAAAA | |
AAAAAAAAAUGAgMEAQcJ/8QASRAAAgEDAwIFAgIFCAYIBwAAAQIDBAURABIhBjEHEyJBURR | |
hMnEVQnKBkSMzNFJigqGxCBckJbLCQ1NVlKLR0/Fzg5LB0uHw/8QAGwEAAgMBAQEAAAAAA | |
AAAAAAAAAUDBAYBAgf/xAA6EQABAwIEAwUGBAUFAQAAAAABAAIDBBEFITFBElGBYXGRobE | |
GEyLB0fAVI0LxFjJSguEkM0NTwqL/2gAMAwEAAhEDEQA/AP2M0001uF83TTTTQhNNNNCE0 | |
1xXg9UUttN9orfSx284WOtrpiqu+ccAc4+DjB+fmuRXzr2qnpTcIIaJklHnJDVRrDKNw9J | |
85PNBKc4Cr3A3DuI2zQvvwuBtlkQfRde2SO3E059iuGtFXdLZQOI664wQsUZwssyqSq925 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Mandelbrot</title> | |
<meta http-equiv="Content-Script-Type" content="text/javascript"> | |
<style type="text/css"> | |
h { text-align: center; } | |
#mycanvas { border: 1px solid black; cursor: crosshair; | |
margin-left: 1%; margin-right: 1%; } | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Format preserving encryption using a Feistel network | |
See https://stackoverflow.com/a/51429458/4014959 | |
Written by PM 2Ring 2016.08.22 | |
Version using Blake2 hashing 2021.06.14 | |
Added pair permutation 2024.01.17 | |
""" | |
from hashlib import blake2s as blake | |
from random import Random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Plot filled ellipse in 3D. | |
With major axis and line of nodes | |
Written by PM 2Ring 2023.9.24 | |
""" | |
var('th') | |
deg = n(pi / 180) | |
def ellipse(a, ec): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Gauss / Salamin / Brent true AGM pi | |
Binary fixed point | |
Written by PM 2Ring 2023.11.1 | |
""" | |
from math import isqrt | |
def AGM_pi(loops, bits): | |
a, b = 1 << bits, isqrt(1 << 2*bits-1) | |
s = 1 << bits-2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Chromostereopsis illusion | |
With generated blue noise dither (void & cluster), | |
Poisson disk, white noise, checks, and undithered. | |
See https://mathematica.stackexchange.com/q/289992 | |
""" | |
import numpy as np | |
from scipy import ndimage | |
from sage.repl.image import Image |
NewerOlder