{{ message }}

Instantly share code, notes, and snippets.

🎯
Focusing
Last active Sep 3, 2020
Nelder-Mead multidimensional minimization in Clojure, based on Colin Smith's excellent work!
View minimize.cljc
 (ns sicmutils.numerical.minimize "Implementations of minimization algorithms for single and multiple dimensions." (:require [sicmutils.util :as u] [sicmutils.util.stopwatch :as us] [taoensso.timbre :as log]) #?(:clj (:import (org.apache.commons.math3.optim.univariate BrentOptimizer UnivariateObjectiveFunction SearchInterval
Created Aug 28, 2020
View ex15.md

# Exercise 1.15: Equivalence

This is one of the more important exercises in the chapter. The problem asks for a proof that it's possible to absorb a coordinate transformation directly into the Lagrangian. If you can do this, you can express your paths and your forces in whatever coordinates you like, so long as you can transition between them.

I also found that this exposed, and repaired, my weakness with the functional notation that Sussman and Wisdom have used in the book.

The problem states:

Show by direct calculation that the Lagrange equations for \$L'\$ are satisfied if the Lagrange equations for \$L\$ are satisfied.

Last active Aug 28, 2020
View ex15.md

# Exercise 1.15: Equivalence

This is one of the more important exercises in the chapter. The problem asks for a proof that it's possible to absorb a coordinate transformation directly into the Lagrangian. If you can do this, you can express your paths and your forces in whatever coordinates you like, so long as you can transition between them.

I also found that this exposed, and repaired, my weakness with the functional notation that Sussman and Wisdom have used in the book.

The problem states:

Show by direct calculation that the Lagrange equations for \$L'\$ are satisfied if the Lagrange equations for \$L\$ are satisfied.

Created Aug 21, 2020
View errors.clj
 (deftest bigint-repro (testing "[No method in multimethod 'sicmutils.generic/div' for dispatch value: [#object[Number] :sicmutils.polynomial/polynomial]]" (hermetic-simplify-fixture (fn [] (sicmutils.generic/simplify (* 0.5 (/ 1 (* 2 'x))))))) (testing "TypeError: Cannot mix BigInt and other types, use explicit conversions" (* 0.5 (u/bigint 2))
Last active Aug 21, 2020
View setup.py
 from setuptools import find_packages, setup # This follows the style of Jaxlib installation here: # https://github.com/google/jax#pip-installation PYTHON_VERSION = "cp37" CUDA_VERSION = "cuda101" # alternatives: cuda90, cuda92, cuda100, cuda101 PLATFORM = "linux_x86_64" # alternatives: linux_x86_64 BASE_URL = "https://storage.googleapis.com/jax-releases"
Created Jul 22, 2020
View complex_error.js
This file has been truncated, but you can view the full file.
 #!/usr/bin/env node if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) { Math.imul = function (a, b) { var ah = (a >>> 16) & 0xffff; var al = a & 0xffff; var bh = (b >>> 16) & 0xffff; var bl = b & 0xffff; // the shift by 0 fixes the sign on the high part // the final |0 converts the unsigned value into a signed value
Created Jul 22, 2020
View help.cljs
This file has been truncated, but you can view the full file.
 #!/usr/bin/env node if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) { Math.imul = function (a, b) { var ah = (a >>> 16) & 0xffff; var al = a & 0xffff; var bh = (b >>> 16) & 0xffff; var bl = b & 0xffff; // the shift by 0 fixes the sign on the high part // the final |0 converts the unsigned value into a signed value
Last active Jan 30, 2020
Content addressable file manager, rewritten to use pyfilesystem2
View hashfs.py
 import hashlib import io import os from contextlib import closing from typing import Iterable, Optional, Tuple, Union import fs as pyfs import util as u from fs.permissions import Permissions
Created Jun 9, 2014
Typeclasses in Swift
View algebra.swift
 // Playground - noun: a place where people can play import Cocoa var str = "Hello, playground" // Here's take 1. First, I defined the algebra like I would in // Scala, as separate protocols: protocol Semigroup { typealias T
Created Sep 4, 2013
View thrift.clj
 // First pass at a thrift parser using instaparse: (def instagram (insta/parser " Document ::= Header* Definition* SlashComment ::= <'//'> #'[^\n]'* PoundComment ::= <'#'> #'[^\n]'* BlockComment ::= '/*' #'(?s).'* '*/' Comment ::= SlashComment | PoundComment | BlockComment |
You can’t perform that action at this time.