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 contextlib | |
@contextlib.contextmanager | |
def timing(results=None): | |
""" | |
Time the execution of the block of code. If a results list is | |
passed in, the time is appended to the list. Also returns a list | |
of one element containing the time the execution took. | |
To use, do something like: |
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
class mydecorator(object): | |
def __init__(self, times, repeats): | |
self.times=times | |
self.repeats=repeats | |
self.a=1 | |
def __call__(self, func): | |
# here, we just need to return a new function. That new function will be what is actually stored in the name and run when I. | |
def myfunc(*args, **kwargs): | |
# *this* inner function is what is actually called |
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 fsum(x,a): | |
g(x) = 1/2 | |
list_of_terms=[2*(((-1)^n-1)/(n*pi)^2*cos(n*pi*x)-(-1)^n/(n*pi)*sin(n*pi*x)) for n in [1..a]] | |
g += sum(list_of_terms) | |
return g |
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
print 'hi' |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Simple Compute Server</title> | |
<script type="text/javascript" src="http://sagemath.org:5467/static/jquery-1.5.min.js"></script> | |
<script type="text/javascript" src="http://sagemath.org:5467/embedded_singlecell.js"></script> | |
<script> |
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
TEXT(<<'EOF'); | |
<div id="singlecell-test"><script type="text/code">var('x') | |
x0 = 0 | |
f(x) = sin(x)*e^(-x) | |
p = plot(f,(x,-1,5), thickness=2) | |
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0)) | |
@interact | |
def _(order=(1..12)): | |
ft = f.taylor(x,x0,order) | |
pt = plot(ft,(x,-1, 5), color='green', thickness=2) |
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
;; Enable tab and shift-tab to continuously indent/dedent rst blocks | |
(add-hook 'rst-mode-hook | |
(function (lambda () | |
(setq indent-region-function (lambda (&rest n) | |
(rst-shift-region-right nil) | |
(setq deactivate-mark nil))) | |
(local-set-key [S-tab] (lambda (&rest n) | |
(interactive) | |
(if (use-region-p) | |
(progn (rst-shift-region-left 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
## DESCRIPTION | |
## Linear Algebra | |
## ENDDESCRIPTION | |
## KEYWORDS('matrix' 'null space' 'vector') | |
## Tagged by tda2d | |
## DBsubject('Linear Algebra') | |
## DBchapter('Matrices') | |
## DBsection('Image and Kernel') |
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: iso-8859-1 -*- | |
""" | |
MoinMoin - Sage Cell Parser | |
@copyright: 2010 by Chris Martino <chris@console.org>, Jason Grout <jason-sage@creativetrax.com> | |
@license: GNU GPL. | |
""" | |
from MoinMoin.parser._ParserBase import ParserBase | |
from uuid import uuid4 |
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
{ | |
"content": [ | |
{ | |
"parent_header": { | |
"username": "", | |
"msg_id": "4f5e129c-da63-4db2-9bf6-d2ad89b898fa", | |
"session": "c9ec7d91-6a89-4aa4-bdf5-f1d55bbd387c" | |
}, | |
"msg_type": "extension", | |
"sequence": 0, |