0 Replies - 660 Views - Last Post: 07 May 2013 - 12:22 PM

#1 jayy_two  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 28-October 12

determinant of 3x3 matrix in prolog

Posted 07 May 2013 - 12:22 PM

I'm trying to create a 3x3 matrix using lists, and then find the determinant.
When I run it i keep getting the error:
No permission to modify static_procedure `(=)/2'

What exactly is wrong?


A = [1,2,3].
B = [4,5,6].
C = [7,8,9].

%diagonals
n is nth(A,0)*nth(B,1)*nth(C,2).
m is nth(A,1)*nth(B,2)*nth(C,0).
o is nth(A,2)*nth(B,0)*nth(C,1).
x is n+m+o.

p is nth(A,2)*nth(B,1)*nth(C,0).
q is nth(A,0)*nth(B,2)*nth(C,1).
r is nth(A,1)*nth(B,0)*nth(C,2).
y is p+q+r.

z is x-y.
determinant is z.



Is This A Good Question/Topic? 0
  • +

Page 1 of 1