# determinant of 3x3 matrix in prolog

Page 1 of 1

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

### #1 jayy_two

Reputation: 0
• Posts: 63
• 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

 .related ul{list-style-type:circle;font-size:12px;font-weight:bold;}.related li{margin-bottom:5px;background-position:left 7px!important;margin-left:-35px;}.related h2{font-size:18px;font-weight:bold;}.related a{color:blue;}