Python CashFlow Calculator

I am trying to formulate an equation that can calculate the outstanding_balance in one go using python. It is quite simple using the iterative process. For example: for month in range(1, self.amortMonths + 1): # Calculate intial and future ...
more »

2017-07-04 19:07 (2) Answers

Random solutions of undetermined linear systems

Consider an underdetermined linear system of equations Ax=b. I would like to find a set of vectors x_1, ..., x_n such that they all solve Ax=b and they are as different between each other as possible. The second part is actually less important; I ...
more »

2017-04-15 09:04 (2) Answers

Adding two matrix with different dimension

Let A be a matrix with [m x n] elements and B another matrix with [m x n x o] elements. Is there any linear algebraic way to add both matrices such that C = A + B where C will be in [m x n x o] without any sort of looping along the o dimension? Exam...
more »

2017-03-06 12:03 (4) Answers

Matrix multiplication issue for LU decomposition?

I'm trying to solve an Ax=b by using LU decomposition, but somehow I can't get the A by multiplying L*U. Here's the code and the results; A = array([2,3,5,4]).reshape(2,2) b = array([4,3]) P,L, U = lu(A) And the results for L and U L: array([[ 1...
more »

2017-02-26 11:02 (2) Answers

Numpy inverts a non-invertible matrix

I friend and I executed this line of code in Python 2 and Python 3: import numpy as np mat = np.array([[1,0,0],[-1,3,3],[1,2,2]]) np.linalg.inv(mat) Which returns: array([[ 1.00000000e+00, 0.00000000e+00, 0.00000000e+00], [ 1.5011998...
more »

2017-01-25 01:01 (2) Answers

Error with NumPy transpose

I'm trying to figure out what is going on here, but I'm a little bit baffled. I am getting unexpected results working with a transposed NumPy identity matrix (which should have no effect). For example: import numpy as np N = 1000 # case 1: A = np....
more »

2017-01-17 13:01 (0) Answers

associativity of matrix multiplication in numpy

I am playing with a simple numpy example and having hard time to understand why associative property of matrix multiplication ABC = (AB)C = A(BC) does not exactly hold. I assume the problem is with numeric stability. But how to address it? What i...
more »

2016-12-08 19:12 (0) Answers

Ax=b with b dependent on x

I understand how to solve Ax=b, but what if b is dependent on x? See in the pictures E3 = function(E4). I guess this is done iteratively.. what is such a problem called? what methods do I use to solve it? I am trying to solve the following system: ...
more »

2016-10-01 11:10 (2) Answers