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
Size = 2 | |
k = 3 | |
xstartswitchpoint = Matrix([[5.], [5.]]) # y,Vy | |
Aklinnonlin = Matrix([[k,1],[0,-0.5]]) | |
b2x2 = Matrix([[5.], [-3.]]) | |
dydx = zeros(Size,1) | |
dydx | |
def dxdt_y(Aklinnonlin, xstartswitchpoint, b2x2): | |
dydx[0,0] += xstartswitchpoint[1,0] | |
dydx[1,0] += -1 * Aklinnonlin[0,0] * (xstartswitchpoint[1,0]) - 9.81 |
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 as sp | |
import math | |
import re | |
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z = sp.symbols('a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z') | |
formula = input('') | |
unknown_values = int(input('how many unknown values?: ')) | |
unknown_array = [] |
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
""" | |
Each line in .mailmap is a comment, blank or mapping. A mapping | |
contains 1 or 2 email addresses and may terminate with a comment | |
that extends from the first # to the end of the physical line. An | |
address starts with a left angle bracket and extends through the | |
first unnested right angle bracket; it need not conform to a | |
valid email address and may contain space. A name is interpreted | |
as anything before the first address or between the two addresses | |
except for leading and trailing space. |
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
python.exe bin\authors_update.py | |
?[31m | |
Ambiguous email address error: entries must be added to .mailmap to | |
identify the canonical name and email address for each of them. Then | |
re-run this script.?[0m | |
Ramana Venkata <idlike2dream@gmail.com> | |
Venkata Ramana <idlike2dream@gmail.com> | |
Gaurav Dhingra <gauravdhingra.gxyd@gmail.com> |
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
These are all of our assumptions in master: | |
['algebraic', 'antihermitian', 'commutative', 'complex', 'composite', | |
'even', 'finite', 'hermitian', 'imaginary', 'infinite', 'integer', | |
'irrational', 'negative', 'noninteger', 'nonnegative', 'nonpositive', | |
'nonzero', 'odd', 'positive', 'prime', 'rational', 'real', | |
'transcendental', 'zero'] | |
Beta_rules gives the ways to prove different items. For example, we | |
know a number is odd if even is False and integer is 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
def gut(string): | |
"""gzip the string and return the uu -encoded version.""" | |
import StringIO, uu, gzip, hashlib | |
def md5(e): | |
return hashlib.md5(str(e)).hexdigest() | |
zipp = StringIO.StringIO() | |
uuu = StringIO.StringIO() | |
g = gzip.GzipFile(fileobj=zipp, mode='wb') # gzip(path, 'wb') | |
g.write(string) | |
g.close() |
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
DEMO | |
regular | |
>>> (1/x+1/y+1/z+1/w).as_numer_denom() | |
(w*x*y + w*x*z + w*y*z + x*y*z, w*x*y*z) | |
binary-horner | |
>>> (1/x+1/y+1/z+1/w+1/u).binary() | |
(u*x*y*z + w*(u*z*(x + y) + x*y*(u + z)), u*w*x*y*z) | |
TIMING |
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
DEMO | |
regular | |
```python | |
>>> (1/x+1/y+1/z+1/w).as_numer_denom() | |
(w*x*y + w*x*z + w*y*z + x*y*z, w*x*y*z) | |
``` | |
binary-horner | |
```python | |
>>> (1/x+1/y+1/z+1/w+1/u).binary() | |
(u*x*y*z + w*(u*z*(x + y) + x*y*(u + z)), u*w*x*y*z) |
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
"""Return a sympy object representing the absolute value of the argument. | |
This is an extension of the built-in function abs() to accept symbolic | |
values. If you pass a SymPy expression to the built-in abs(), it will | |
pass it automatically to Abs(). | |
Examples:: | |
>>> from sympy import Abs, Symbol, S | |
>>> x = Symbol('x', real=True) |