This file contains 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
""" | |
This file contains a class Polynomial that allows evaluating and | |
making operations with polynomials, like adding, multiplying, etc | |
""" | |
from __future__ import annotations | |
import math | |
from typing import Tuple, Union | |
Parameter = Union[int, float] |
This file contains 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
""" | |
This file contains a class Trignomio that allows evaluating and | |
making operations with trignomios, like adding, multiplying, etc | |
A trignomio is similar to a polynomial, but uses trignometic functions | |
Example | |
------- | |
>>> trig = Trignomio([1, 2, 3]) | |
>>> print(trig) |
This file contains 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
import sympy as sp | |
import numpy as np | |
from matplotlib import pyplot as plt | |
class Knotvector: | |
@classmethod | |
def uniform(cls, degree, npts): | |
ninter = npts - degree |
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 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
import numpy as np | |
uppers = "QWERTYUIOPASDFGHJKLZXCVBNM" | |
lowers = "qwertyuiopasdfghjklzxcvbnm" | |
digits = list(map(str, range(10))) | |
specials = "!@#$%&*()+-/" | |
# specials = "!+-()#" | |
# specials = "" | |
chars = set(uppers) |
This file contains 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
def comb(a: int, b: int) -> int: | |
""" | |
Implements the binomial coefficient: | |
( a ) a ! | |
( ) = ------------- | |
( b ) b! * (a-b)! | |
""" | |
prod = 1 | |
for i in range(min(b, a-b)): | |
prod *= a-i |
This file contains 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
import numpy as np | |
from matplotlib import pyplot as plt | |
nelips = 3 | |
ndim = 2 | |
all_axis = [] | |
for i in range(nelips): | |
matrix = np.random.rand(ndim, ndim) | |
matrix += np.transpose(matrix) | |
eigvals, eigvecs = np.linalg.eigh(matrix) |
This file contains 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
from __future__ import annotations | |
from typing import * | |
import numpy as np | |
from matplotlib import pyplot as plt | |
class Point2D: | |
def __init__(self, x: float, y: float): |
This file contains 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
# import matplotlib | |
# matplotlib.use('webagg') | |
import math | |
from typing import Tuple, Union | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from matplotlib.lines import Line2D |
This file contains 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
import numpy as np | |
from matplotlib import pyplot as plt | |
from typing import Tuple | |
class Conic: | |
def __init__(self, coefs: Tuple[float]): | |
self.coefs = coefs |
NewerOlder