The page you are reading is part of a draft (v2.0) of the "No bullshit guide to math and physics."
The text has since gone through many edits and is now available in print and electronic format. The current edition of the book is v4.0, which is a substantial improvement in terms of content and language (I hired a professional editor) from the draft version.
I'm leaving the old wiki content up for the time being, but I highly engourage you to check out the finished book. You can check out an extended preview here (PDF, 106 pages, 5MB).
The notation for matrices as lists of lists is very tedious to use for practical calculations. If you need to input a matrix with three columns and ten rows, you'll have to write a lot of square brackets!
There is another convention for specifying matrices which is more convenient.
If you have access to numpy
on your computer, you can specify matrices
in the alternate notation
>>> from numpy import mat as M >>> A = Matrix( M('1 2; 3 9') ) >>> A.inv() # call the inv method on A [ 3, -2/3] [-1, 1/3]
When computing determinants, we attribute particular attention to whether the the zero-vs-nonzero nature Of particular interest is the
adjugate
Consider the parallelepiped which has as its sides the vectors $\vec{u}=(1,2,3)$, $\vec{v}=(2,−2,4)$, and $\vec{w} =(2,2,5)$. If we place these vectors as the rows of matrix $M$, then $\det(M)$ is the volume of the parallelepiped:
>>> M = Matrix( [[1, 2, 3], [2,-2, 4], [2, 2, 5]] ) >>> M.det() # V = det( [u above v above w] ) 2 >>> M.row(0).dot( M.row(1).cross( M.row(2) ) ) 2 # verify using V = u\cdot( v \times w )
The volume of the parallelepiped is 2.
By default, sympy
compute derivative or integral expression eagerly.
If you tell it to
Limit(sin(x)/x, x, 0) Derivative Integral
The student can then enter their answer in a textarea:
// x(t) answer = function (t) { var tt,ttt; return x_i + integrate( v_i + integrate( a, (tt,0,ttt)), (ttt,0,t) ); }
You can use python
as a basic calculator
>>> 2+2 4 >>> [1,2,3] [1,2,3]
Keep this in mind and always simplify things before you try to compare them.
>>> map(lambda e:e.subs({'a':1,'b':2,'c':-8}), solve(a*x**2+b*x+c,x) ) [2, -4]
>>>
exp2.rewrite(exp)
In [23]: print (E(I*x)).expand(complex=True) I*sin(x) + cos(x) »> ( (A*e1)[0] ).rewrite(exp) x,f=symbols('x,f',real=True) exp1=E(-I*2*pi*f*x)
exp2=exp1.expand(complex=True)
exp2 returns: -I*sin(2*pi*f*x) + cos(2*pi*f*x)
Is there a way to go from exp2 back to exp1?
I'm relatively new over here, but I think this should do.
>>> >>>exp(-2*I*pi*f*x)
>>> def axn_sin(x,n): # press SHIFT+ENTER for a newline return (-1.0)**n * x**(2*n+1) / factorial(2*n+1)
>>> sum( [ axn_sin(forty,n) for n in range(0,10) ] ) >>> sin(forty).evalf()
>>> summation( sk, (k,1,n) )
>>> def an_ln2(n): return 1.0*(-1)**(n+1)/n >>> sum([ an_ln2(n) for n in range(1,1000) ])