Skip to content

Instantly share code, notes, and snippets.

View lidavidm's full-sized avatar

David Li lidavidm

View GitHub Profile
@lidavidm
lidavidm / gist:1407363
Created November 30, 2011 00:35
Sympy doctest output
============================= test process starts ==============================
executable: /usr/bin/python (2.7.2-final-0)
architecture: 64-bit
cache: yes
ground types: python
sympy/polys/rootisolation.py[1] . [OK]
sympy/polys/sqfreetools.py[12] ............ [OK]
sympy/polys/monomialtools.py[8] ........ [OK]
sympy/polys/galoistools.py[70] .................................................
@lidavidm
lidavidm / Screenshot from 2012-10-15 19:08:28.png
Created October 16, 2012 02:03
Hosting for Github pull request images
Screenshot from 2012-10-15 19:08:28.png
@lidavidm
lidavidm / 16.4.16.py
Created November 27, 2012 23:37
Calculus, Chapter 16.4 problem 16
# -*- coding: utf-8 -*-
# Warning: takes FOREVER to run!
from sympy.core import Symbol, diff, pi, sympify
from sympy.integrals import integrate
from sympy.functions import sin, cos, sqrt
x, y, t = map(Symbol, 'xyt')
P = 2*x - (x**3) * (x**5)
Q = (x**3) * (y ** 8)
\startenvironment env_mocktest
% Font
\definefontfeature[default][mode=node, kern=yes, liga=yes, dlig=yes,protrusion=quality,expansion=quality]
\usemodule[simplefonts][size=11.5pt]
\setmainfont[(FONT NAME REMOVED)]
\setsansfont[(FONT NAME REMOVED)]
\setupalign[right,nothyphenated,stretch,hz,verytolerant]
% Page
@lidavidm
lidavidm / diffsteps.py
Last active December 15, 2015 00:09
Derivative steps using strategies module
import sympy
from sympy.strategies.core import switch
from sympy.core.function import AppliedUndef
from sympy.functions.elementary.trigonometric import TrigonometricFunction
import collections
def Rule(name, props=""):
return collections.namedtuple(name, props + " context symbol")
@lidavidm
lidavidm / rungekutta.py
Created May 22, 2013 23:21
Runge-Kutta implementation in Python + mpmath
#!/usr/bin/env python2
import mpmath
@mpmath.extradps(30)
def runge_kutta(f, t0, y0, h, steps):
t = t0
y = y0
for n in range(steps):
k1 = f(t, y)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Processor Information:
Vendor: GenuineIntel
CPU Family: 0x6
CPU Model: 0x3a
CPU Stepping: 0x9
CPU Type: 0x0
Speed: 3200 Mhz
4 logical processors
2 physical processors
HyperThreading: Supported
from HTMLParser import HTMLParser
class MultiResultParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.results = [[]]
self.tag_type = None
def handle_starttag(self, tag, attrs):
attrs = dict(attrs)