Welcome to SymPy (Alan Bromborsky)
[sympy.git] / examples / vandermonde.py
blob201ed7d7eb112a430a7e93594a9fc135831aecd2
1 #!/usr/bin/env python
2 import iam_sympy_example
4 from sympy import sqrt, symbols, eye
6 w, x, y, z = symbols("wxyz")
7 L = [x,y,z]
8 V = eye(len(L))
9 for i in range(len(L)):
10 for j in range(len(L)):
11 V[i,j] = L[i]**j
12 det = 1
13 for i in range(len(L)):
14 det *= L[i]-L[i-1]
16 print "matrix"
17 print V
18 print "det:"
19 print V.det().expand()
20 print "correct result"
21 print det
22 print det.expand()