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
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue Aug 2 15:43:21 2011 | |
@author: gustavo | |
""" | |
from scipy.optimize import fmin_cobyla | |
import numpy as np |
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 | |
import sympy.utilities | |
from sympy import symbols | |
from sympy.physics.mechanics import * | |
#based on http://pydy.org/index.php?title=Double_Pendulum | |
q1, q2 = dynamicsymbols('q1 q2') | |
q1d, q2d = dynamicsymbols('q1 q2', 1) | |
u1, u2 = dynamicsymbols('u1 u2') |
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 as mpl | |
import matplotlib.pyplot as plt | |
r1 = mpl.patches.Rectangle((0.0,0.0),2.0,3.0) | |
r2 = mpl.patches.Rectangle((0.0,0.0),3.0,2.0) | |
r3 = mpl.patches.Rectangle((10.0,10.0),2.0,3.0) | |
r1.set_color('r') | |
r2.set_color('g') | |
r3.set_color('b') |
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.pyplot as plt | |
import matplotlib.animation as animation | |
import matplotlib as mpl | |
ani_fig = plt.figure(None) | |
ani_ax = ani_fig.gca() | |
ani_ax.set_xlim(0,1) | |
ani_ax.set_ylim(0,1) | |
ani_ax.set_aspect('equal') |
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 scipy.spatial import Delaunay | |
#from http://pydec.googlecode.com/svn-history/r10/trunk/pydec/math/circumcenter.py | |
__all__ = ['is_wellcentered', 'circumcenter', 'circumcenter_barycentric'] | |
from numpy import bmat, hstack, vstack, dot, sqrt, ones, zeros, sum, \ | |
asarray |
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
#LyX 2.0 created this file. For more info see http://www.lyx.org/ | |
\lyxformat 413 | |
\begin_document | |
\begin_header | |
\textclass article | |
\begin_preamble | |
\usepackage[T1]{fontenc} | |
\usepackage{multicol} | |
\end_preamble | |
\use_default_options true |
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
Code: | |
import numpy as np | |
ndims = 3 | |
nbowls = 1 #no crash if this is >1 | |
npts = 10000 | |
bowls = np.random.randn(ndims,ndims,nbowls) | |
queries = np.random.randn(ndims,npts) |
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
{ | |
"metadata": { | |
"name": "Interpolations-Copy1" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
module BallTree | |
dist = (p,q)->norm(p-q) | |
macro argbest(metric,compare,candidates,query) | |
#returns index into candidates with best metric | |
local best_so_far_value = metric(candidates[1],query) | |
local best_so_far_index = 1 | |
for i in 1:length(candidates) | |
local m = metric(candidates[i],query) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer