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
;;;; Floating | |
;; See https://github.com/aijony/coalton/tree/simple-float | |
(coalton-toplevel | |
(define-class ((Dividable :a :a) (Num :a) => Floating :a) | |
"Common floating point operations." | |
(pi :a) | |
(sqrt (:a -> :a)) | |
;; a ** x = exp(x log(a)) |
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 __init__(self, xMin, xMax, N): | |
# Define class variables | |
self.xMin = xMin | |
0 | |
0 | |
self.deltax = 0 | |
# Define class function |
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
(defun notmuch/switch-keys (keymap keyslist) | |
"Swaps OLDKEY with NEWKEY in KEYMAP without changing the | |
key's definition" | |
(dolist (keys keyslist) | |
(let ((oldkey (car keys)) | |
(newkey (car (cdr keys)))) | |
(define-key keymap (kbd newkey) (lookup-key keymap (kbd oldkey))) | |
(define-key keymap (kbd oldkey) nil)))) |
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
data = [(0, 0), (1, 2), (2, 4), (3, 6), (4, 8)] | |
m = 0 | |
b = 0 | |
def testFunc(x): | |
return m * x + b | |
def leastSquares(func, data): | |
results = 0 | |
for datum in data: |
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
data = [(0, 0), (1, 2), (2, 4), (3, 6), (4, 8)] | |
m = 0 | |
b = 0 | |
def testFunc(x): | |
return m * x + b | |
def leastSquares(func, data): | |
results = 0 | |
for datum in data: |
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 sage.symbolic.expression import is_Expression, is_SymbolicEquation | |
def name(func_name, expr): | |
r""" | |
Name a an unnamed symbolic function or expression. | |
INPUT: | |
- ``func_name`` -- string (default: 1) The to be given name | |
if the function |