Skip to content

Commit

Permalink
Made wronskian work with empty matrices
Browse files Browse the repository at this point in the history
This is necessary to apply variation of parameters to first order odes,
such as f(x).diff(x) - sin(x)

The determinant (and thus the wronskian) of an empty matrix is defined
to be 1.
  • Loading branch information
asmeurer committed Aug 18, 2009
1 parent 4c9f90a commit 1e49496
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sympy/matrices/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,8 @@ def wronskian(functions, var):
for index in xrange(0, len(functions)):
functions[index] = sympify(functions[index])
n = len(functions)
if n == 0:
return 1
W = Matrix(n, n, lambda i,j: functions[i].diff(var, j) )
return W.det()

Expand Down

0 comments on commit 1e49496

Please sign in to comment.