0

im trying to solve the task starting on page 9 with method 2 http://www.math.ucla.edu/~baker/149.1.02w/handouts/dd_splines.pdf

My code:

import numpy as np
from numpy.linalg import inv

s0=[1,-1]
s1=[-1,2]
s2=[1,4]
s3=[4,3]
s4=[7,5]

M=inv(np.array([[4,1,0],[1,4,1],[0,1,4]]))
C=np.array([(np.dot(6,s1)-s0), np.dot(6,s2),(np.dot(6,s3)-s4) ]) 

print np.dot(M*C)

Traceback (most recent call last): File "C:/Users/john/Desktop/testint.py", line 16, in print np.dot(M*C) ValueError: operands could not be broadcast together with shapes (3,3) (3,2)

So my simple question is how is this done in correct way?

SailorS
  • 1
  • 1
  • 2
  • 2
    Did you intend np.dot(M,C) ? – paisanco Dec 16 '17 at 13:53
  • 2
    Sorry, but I'm not going to open a link, go to page 9 and check method 2 to see what your problem is, and I don't think anyone else will either. Please include the _full_ problem statement here. – cs95 Dec 16 '17 at 13:55
  • Dot suggests a scalar product. Matrix multiplication returns a matrix. You probably chose the wrong function. – duffymo Dec 16 '17 at 15:52

0 Answers0