Baham's Blog

Above all else, guard your heart.

What an Amazing Software

Sage I knew this software about 2 years ago. When I was on a cryptology calss. And the reacher notice this amazing math software. He showed it with virtual mechine. Cause he use windows as his os. But you know that time, I already started to use linux.

And after that class, I installed sage, but nearlly not use it.

Until in these days, I heard a friend talk about using Matlab to calculate something for his paper. And I decided to learn a math software seriously.

Like him, I want to choose Matlab, but it is not free. Although my friend tell me matlab is easy to learn.

Finally, I choose sagemath. Just because it is free.

But when I read the sage’s tutorial.

I found an amazing thing:

sudoku function!!!

1
2
3
4
A = matrix(ZZ,9,[5,0,0, 0,8,0, 0,4,9, 0,0,0, 5,0,0,
    0,3,0, 0,6,7, 3,0,0, 0,0,1, 1,5,0, 0,0,0, 0,0,0, 0,0,0, 2,0,8, 0,0,0,
    0,0,0, 0,0,0, 0,1,8, 7,0,0, 0,0,4, 1,5,0,   0,3,0, 0,0,2,
    0,0,0, 4,9,0, 0,5,0, 0,0,3])

Show the matrix:

1
2
3
4
5
6
7
8
9
10
11
A

         [5 0 0 0 8 0 0 4 9]
        [0 0 0 5 0 0 0 3 0]
        [0 6 7 3 0 0 0 0 1]
        [1 5 0 0 0 0 0 0 0]
        [0 0 0 2 0 8 0 0 0]
        [0 0 0 0 0 0 0 1 8]
        [7 0 0 0 0 4 1 5 0]
        [0 3 0 0 0 2 0 0 0]
        [4 9 0 0 5 0 0 0 3]

And when you use sudoku(A)

The sudoku puzzle will be solved!

1
2
3
4
5
6
7
8
9
10

      [5 1 3 6 8 7 2 4 9]
        [8 4 9 5 2 1 6 3 7]
        [2 6 7 3 4 9 5 8 1]
        [1 5 8 4 6 3 9 7 2]
        [9 7 4 2 1 8 3 6 5]
        [3 2 6 7 9 5 4 1 8]
        [7 8 2 9 3 4 1 5 6]
        [6 3 5 1 7 2 8 9 4]
        [4 9 1 8 5 6 7 2 3]

What a math software!




The Original Link: http://baham.github.io/05_06_what-an-amazing-software.html
If you want to reprint it, please do under the CC BY-NC-SA 4.0

Comments