

I am very new to Matlab and I am using Octave. I am trying to get the Matlab
code that is is at https://oeis.org/A316667 to run. It follows on from a
Numberphle video on Knight's tour. I have already discovered that Matlab
paths do not like upper case or spaces in paths and filenames and I have
fixed that but in line 52 of the code there is this command
xy2num = @(x,y) SpiralNumbering(x,y);
It is not referenced anywhere else.
Octave gives this error
error: 'spiralnumbering' undefined near line 52 column 25
error: called from
knightstour>@<anonymous> at line 52 column 25
knightstour at line 78 column 19
>>
I am at the moment baffled. Can anyone throw any light on this?

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html


I am very new to Matlab and I am using Octave. I am trying to get the Matlab
code that is is at https://oeis.org/A316667 to run. It follows on from a
Numberphle video on Knight's tour. I have already discovered that Matlab
paths do not like upper case or spaces in paths and filenames and I have
fixed that but in line 52 of the code there is this command
xy2num = @(x,y) SpiralNumbering(x,y);
It is not referenced anywhere else.
Octave gives this error
error: 'spiralnumbering' undefined near line 52 column 25
error: called from
knightstour>@<anonymous> at line 52 column 25
knightstour at line 78 column 19
>>
I am at the moment baffled. Can anyone throw any light on this?
The actual code is https://oeis.org/A316667/a316667.m.txt. The error message is the solution to the problem: the author, Daniël Karssen, forgot to add the function "SpiralNumbering" to his contribution. Just to be sure, I checked with Matlab and it doesn't work there either. Maybe you just ask the author to provide the missing function.
HTH, Kai


I am very new to Matlab and I am using Octave. I am trying to get the Matlab
code that is is at https://oeis.org/A316667 to run. It follows on from a
Numberphle video on Knight's tour. I have already discovered that Matlab
paths do not like upper case or spaces in paths and filenames and I have
fixed that but in line 52 of the code there is this command
xy2num = @(x,y) SpiralNumbering(x,y);
It is not referenced anywhere else.
Octave gives this error
error: 'spiralnumbering' undefined near line 52 column 25
error: called from
knightstour>@<anonymous> at line 52 column 25
knightstour at line 78 column 19
>>
I am at the moment baffled. Can anyone throw any light on this?
Did you get this to work yet? I might be able to help you.

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
 DAS


Hi Doug,
It has not been resolved. The only other post I received was from Kai Ohlhus who tried it in both Octave and Matlab with the same error. He opined that SpiralNumbering was missing and suggested I contact the author. It is clearly not a builtin Matlab function and so I am stuck. The author Daniël Karssen has done quite a lot of work in this area on 0EIS. I have looked at his other contributions to see if he has used it elsewhere. I have not found it. I have no contact details for him and he has not left anyway to contact him in OEIS. I know that programmers are not keen to try and modify someone else's program but I'm guessing that the missing module puts numbers in squares surrounding the knight from the knight's last position. I'm not quite sure how to do that quite apart from having no Matlab experience. So if there' is any light that you can throw on this it will be very welcome. I run a local Mathsjam group in Bexhill and Knight's Tours have been a topic of conversation from time to time. One of our members was George Jellis who is probably the world expert on Knight's Tours but he had not come across this version. I hope to talk about this new problem at our next Mathsjam on 19th February. Whilst I am quite familiar with Knights tours and even played with them as a child when I found out about this particular problem on the Numberphile video I paused it to think about what the likely outcome would be. It seemed to me that given an infinite board and the ability the knight to move to any one of eight squares that it would make a pretty pattern that would go to infinity. So it was a surprise that this is not the case. So if there's any light you can throw on this to get the code going then please let me know.
Regards,
Simon
OK And I have written a function that if you give it a location in that array it finds the eight possible knight move locations, and returns the smallest spiral number's location.
We still have to keep track of the location that have been visited, etc.
Are you interested in these. I will add some comments.
Doug Stewart
PS keep Octave help in the loop.
I am very new to Matlab and I am using Octave. I am trying to get the Matlab
code that is is at https://oeis.org/A316667 to run. It follows on from a
Numberphle video on Knight's tour. I have already discovered that Matlab
paths do not like upper case or spaces in paths and filenames and I have
fixed that but in line 52 of the code there is this command
xy2num = @(x,y) SpiralNumbering(x,y);
It is not referenced anywhere else.
Octave gives this error
error: 'spiralnumbering' undefined near line 52 column 25
error: called from
knightstour>@<anonymous> at line 52 column 25
knightstour at line 78 column 19
>>
I am at the moment baffled. Can anyone throw any light on this?
Did you get this to work yet? I might be able to help you.

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
 DAS

 DAS


Very well done. Yes I will keep Octave in the loop. Can they be incorporated into the code?
Simon
Hi Doug,
It has not been resolved. The only other post I received was from Kai Ohlhus who tried it in both Octave and Matlab with the same error. He opined that SpiralNumbering was missing and suggested I contact the author. It is clearly not a builtin Matlab function and so I am stuck. The author Daniël Karssen has done quite a lot of work in this area on 0EIS. I have looked at his other contributions to see if he has used it elsewhere. I have not found it. I have no contact details for him and he has not left anyway to contact him in OEIS. I know that programmers are not keen to try and modify someone else's program but I'm guessing that the missing module puts numbers in squares surrounding the knight from the knight's last position. I'm not quite sure how to do that quite apart from having no Matlab experience. So if there' is any light that you can throw on this it will be very welcome. I run a local Mathsjam group in Bexhill and Knight's Tours have been a topic of conversation from time to time. One of our members was George Jellis who is probably the world expert on Knight's Tours but he had not come across this version. I hope to talk about this new problem at our next Mathsjam on 19th February. Whilst I am quite familiar with Knights tours and even played with them as a child when I found out about this particular problem on the Numberphile video I paused it to think about what the likely outcome would be. It seemed to me that given an infinite board and the ability the knight to move to any one of eight squares that it would make a pretty pattern that would go to infinity. So it was a surprise that this is not the case. So if there's any light you can throw on this to get the code going then please let me know.
Regards,
Simon
OK And I have written a function that if you give it a location in that array it finds the eight possible knight move locations, and returns the smallest spiral number's location.
We still have to keep track of the location that have been visited, etc.
Are you interested in these. I will add some comments.
Doug Stewart
PS keep Octave help in the loop.
I am very new to Matlab and I am using Octave. I am trying to get the Matlab
code that is is at https://oeis.org/A316667 to run. It follows on from a
Numberphle video on Knight's tour. I have already discovered that Matlab
paths do not like upper case or spaces in paths and filenames and I have
fixed that but in line 52 of the code there is this command
xy2num = @(x,y) SpiralNumbering(x,y);
It is not referenced anywhere else.
Octave gives this error
error: 'spiralnumbering' undefined near line 52 column 25
error: called from
knightstour>@<anonymous> at line 52 column 25
knightstour at line 78 column 19
>>
I am at the moment baffled. Can anyone throw any light on this?
Did you get this to work yet? I might be able to help you.

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
 DAS

 DAS



Very well done. Yes I will keep Octave in the loop. Can they be incorporated into the code?
Simon
We normally bottom post on this list.
Try this.
Hi Doug,
It has not been resolved. The only other post I received was from Kai Ohlhus who tried it in both Octave and Matlab with the same error. He opined that SpiralNumbering was missing and suggested I contact the author. It is clearly not a builtin Matlab function and so I am stuck. The author Daniël Karssen has done quite a lot of work in this area on 0EIS. I have looked at his other contributions to see if he has used it elsewhere. I have not found it. I have no contact details for him and he has not left anyway to contact him in OEIS. I know that programmers are not keen to try and modify someone else's program but I'm guessing that the missing module puts numbers in squares surrounding the knight from the knight's last position. I'm not quite sure how to do that quite apart from having no Matlab experience. So if there' is any light that you can throw on this it will be very welcome. I run a local Mathsjam group in Bexhill and Knight's Tours have been a topic of conversation from time to time. One of our members was George Jellis who is probably the world expert on Knight's Tours but he had not come across this version. I hope to talk about this new problem at our next Mathsjam on 19th February. Whilst I am quite familiar with Knights tours and even played with them as a child when I found out about this particular problem on the Numberphile video I paused it to think about what the likely outcome would be. It seemed to me that given an infinite board and the ability the knight to move to any one of eight squares that it would make a pretty pattern that would go to infinity. So it was a surprise that this is not the case. So if there's any light you can throw on this to get the code going then please let me know.
Regards,
Simon
OK And I have written a function that if you give it a location in that array it finds the eight possible knight move locations, and returns the smallest spiral number's location.
We still have to keep track of the location that have been visited, etc.
Are you interested in these. I will add some comments.
Doug Stewart
PS keep Octave help in the loop.
I am very new to Matlab and I am using Octave. I am trying to get the Matlab
code that is is at https://oeis.org/A316667 to run. It follows on from a
Numberphle video on Knight's tour. I have already discovered that Matlab
paths do not like upper case or spaces in paths and filenames and I have
fixed that but in line 52 of the code there is this command
xy2num = @(x,y) SpiralNumbering(x,y);
It is not referenced anywhere else.
Octave gives this error
error: 'spiralnumbering' undefined near line 52 column 25
error: called from
knightstour>@<anonymous> at line 52 column 25
knightstour at line 78 column 19
>>
I am at the moment baffled. Can anyone throw any light on this?
Did you get this to work yet? I might be able to help you.

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
 DAS

 DAS

 DAS


Very well done. Yes I will keep Octave in the loop. Can they be incorporated into the code?
Simon
We normally bottom post on this list.
Try this.
Now that I have spent some time figuring out spiralnumbers, I can understand the code at With my version of spiralNumbers the move number 1 is at the centre of the square matrix, but they seem to call that spot x0=0 y0=0. So a simple offset should convert between the 2 systems.
this line xy2num = @(x,y) SpiralNumbering(x,y); is making a function xy2num(x,y) that if you give it an x,y location in a spiral array,it gives you back a move number. this part remembers what we have done. % add current square to sequence
seqX(end+1) = x0;
seqY(end+1) = y0; seqNum(end+1) = xy2num(x0,y0);
this part % apply all possible moves x = x0 + dx;
y = y0 + dy; gets all 8 new positions.
So I think I am close :)


I am impressed. Would it be possible to incorporate your code into the original service it now runs?
Simon
Very well done. Yes I will keep Octave in the loop. Can they be incorporated into the code?
Simon
We normally bottom post on this list.
Try this.
Now that I have spent some time figuring out spiralnumbers, I can understand the code at With my version of spiralNumbers the move number 1 is at the centre of the square matrix, but they seem to call that spot x0=0 y0=0. So a simple offset should convert between the 2 systems.
this line xy2num = @(x,y) SpiralNumbering(x,y); is making a function xy2num(x,y) that if you give it an x,y location in a spiral array,it gives you back a move number. this part remembers what we have done. % add current square to sequence
seqX(end+1) = x0;
seqY(end+1) = y0; seqNum(end+1) = xy2num(x0,y0);
this part % apply all possible moves x = x0 + dx;
y = y0 + dy; gets all 8 new positions.
So I think I am close :)



try this!!!! It works for me.
DAS


What am I doing wrong?
I have taken the amended file with the added function of function
q=SpiralNumbering(x,y) and popped it into the editor. When it wanted to
save it I gave it 'knightstournew'. I have then gone to Run and the Command
Window gives me
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
knightstournew>@<anonymous> at line 52 column 25
knightstournew at line 78 column 19
It is as if it does not see the new function at all. I have also watched
a few beginners tutorials on Octave on Youtube just to make sure I am not
missing something obvious.
I see I can type 'knightstournew' in the Command Window but it give the same
result.
For the life of me, I cannot see where I am straying.

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html


What am I doing wrong?
I have taken the amended file with the added function of function
q=SpiralNumbering(x,y) and popped it into the editor. When it wanted to
save it I gave it 'knightstournew'. I have then gone to Run and the Command
Window gives me
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
knightstournew>@<anonymous> at line 52 column 25
knightstournew at line 78 column 19
It is as if it does not see the new function at all. I have also watched
a few beginners tutorials on Octave on Youtube just to make sure I am not
missing something obvious.
I see I can type 'knightstournew' in the Command Window but it give the same
result.
For the life of me, I cannot see where I am straying.
there is this concept of the working directory. If you type in pwd and enter it will show you where you are in your computer's file directories. you should save these files in that location and then try again.

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
 DAS


The error I am seeing is this
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
spiralknightsmove>@<anonymous> at line 52 column 25
spiralknightsmove at line 78 column 19
What I suddenly realised is that spiralknightsmove calls spiralNumbers
I had it in my head that the subroutine had to be within the main code. It
should work provided spiralknightsmove can see spiralNumbers.
So what I have done is to use 'pwd' and that tells me where Octave is
looking. In my case it is
>> pwd
ans = /Users/Simon
Next I accessed both files in Dropbox. I used direct download and then
moved both files to /Users/Simon
Next to be sure I typed
>> ls
spiralNumbers.m
spiralknightsmove.m
There is a lot of other stuff there folders and files but both of these
files are there
Next I opened spiralknightsmove.m in Octave and hit Run. That gives the
error above. So Octave is not seeing the other file even though it is in
the same path. I am not sure why it is still not seeing it.
I am on a Mac but that should not make any difference or is it a file
permission issue?
Simon

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html


The error I am seeing is this
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
spiralknightsmove>@<anonymous> at line 52 column 25
spiralknightsmove at line 78 column 19
What I suddenly realised is that spiralknightsmove calls spiralNumbers
I had it in my head that the subroutine had to be within the main code. It
should work provided spiralknightsmove can see spiralNumbers.
So what I have done is to use 'pwd' and that tells me where Octave is
looking. In my case it is
>> pwd
ans = /Users/Simon
Next I accessed both files in Dropbox. I used direct download and then
moved both files to /Users/Simon
Next to be sure I typed
>> ls
spiralNumbers.m
spiralknightsmove.m
There is a lot of other stuff there folders and files but both of these
files are there
Next I opened spiralknightsmove.m in Octave and hit Run. That gives the
error above. So Octave is not seeing the other file even though it is in
the same path. I am not sure why it is still not seeing it.
I am on a Mac but that should not make any difference or is it a file
permission issue?
Simon

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
get this file also
 DAS


and adding that third file into the same path it runs. Yay. It works. It produces the Figure and the Command Window reports
STOPPED ###### a316667 ###### Move: knight Board: spiral Condition: none Data: 1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36 Sequence finite, at step 2016, square 2084 is visited, after which there are no unvisited squares within one move. #####################
So what a learning curve for me. I see now what went wrong. When the original author posted his code he forgot about the support code. Hence the error. With the code restored/rewritten with grateful thanks, we now have the expected result.
With many, many thanks. What a story to share at the next Mathsjam next week.
In lines 19 to 33 of the original code, there is mention of the king, queen, bishop and rook. Can the same code be used for that? How do I tell it to do the king for instance?
Simon
The error I am seeing is this
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
spiralknightsmove>@<anonymous> at line 52 column 25
spiralknightsmove at line 78 column 19
What I suddenly realised is that spiralknightsmove calls spiralNumbers
I had it in my head that the subroutine had to be within the main code. It
should work provided spiralknightsmove can see spiralNumbers.
So what I have done is to use 'pwd' and that tells me where Octave is
looking. In my case it is
>> pwd
ans = /Users/Simon
Next I accessed both files in Dropbox. I used direct download and then
moved both files to /Users/Simon
Next to be sure I typed
>> ls
spiralNumbers.m
spiralknightsmove.m
There is a lot of other stuff there folders and files but both of these
files are there
Next I opened spiralknightsmove.m in Octave and hit Run. That gives the
error above. So Octave is not seeing the other file even though it is in
the same path. I am not sure why it is still not seeing it.
I am on a Mac but that should not make any difference or is it a file
permission issue?
Simon

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
get this file also
 DAS



It also produced a table of all the moves and Figure 1 as well
and adding that third file into the same path it runs. Yay. It works. It produces the Figure and the Command Window reports
STOPPED ###### a316667 ###### Move: knight Board: spiral Condition: none Data: 1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36 Sequence finite, at step 2016, square 2084 is visited, after which there are no unvisited squares within one move. #####################
So what a learning curve for me. I see now what went wrong. When the original author posted his code he forgot about the support code. Hence the error. With the code restored/rewritten with grateful thanks, we now have the expected result.
With many, many thanks. What a story to share at the next Mathsjam next week.
In lines 19 to 33 of the original code, there is mention of the king, queen, bishop and rook. Can the same code be used for that? How do I tell it to do the king for instance?
Simon
The error I am seeing is this
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
spiralknightsmove>@<anonymous> at line 52 column 25
spiralknightsmove at line 78 column 19
What I suddenly realised is that spiralknightsmove calls spiralNumbers
I had it in my head that the subroutine had to be within the main code. It
should work provided spiralknightsmove can see spiralNumbers.
So what I have done is to use 'pwd' and that tells me where Octave is
looking. In my case it is
>> pwd
ans = /Users/Simon
Next I accessed both files in Dropbox. I used direct download and then
moved both files to /Users/Simon
Next to be sure I typed
>> ls
spiralNumbers.m
spiralknightsmove.m
There is a lot of other stuff there folders and files but both of these
files are there
Next I opened spiralknightsmove.m in Octave and hit Run. That gives the
error above. So Octave is not seeing the other file even though it is in
the same path. I am not sure why it is still not seeing it.
I am on a Mac but that should not make any difference or is it a file
permission issue?
Simon

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
get this file also
 DAS




It also produced a table of all the moves and Figure 1 as well
and adding that third file into the same path it runs. Yay. It works. It produces the Figure and the Command Window reports
STOPPED ###### a316667 ###### Move: knight Board: spiral Condition: none Data: 1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36 Sequence finite, at step 2016, square 2084 is visited, after which there are no unvisited squares within one move. #####################
So what a learning curve for me. I see now what went wrong. When the original author posted his code he forgot about the support code. Hence the error. With the code restored/rewritten with grateful thanks, we now have the expected result.
With many, many thanks. What a story to share at the next Mathsjam next week.
In lines 19 to 33 of the original code, there is mention of the king, queen, bishop and rook. Can the same code be used for that? How do I tell it to do the king for instance?
Lines 12 15 define which problem to work on. I have not tried it.
The error I am seeing is this
error: 'SpiralNumbering' undefined near line 52 column 25
error: called from
spiralknightsmove>@<anonymous> at line 52 column 25
spiralknightsmove at line 78 column 19
What I suddenly realised is that spiralknightsmove calls spiralNumbers
I had it in my head that the subroutine had to be within the main code. It
should work provided spiralknightsmove can see spiralNumbers.
So what I have done is to use 'pwd' and that tells me where Octave is
looking. In my case it is
>> pwd
ans = /Users/Simon
Next I accessed both files in Dropbox. I used direct download and then
moved both files to /Users/Simon
Next to be sure I typed
>> ls
spiralNumbers.m
spiralknightsmove.m
There is a lot of other stuff there folders and files but both of these
files are there
Next I opened spiralknightsmove.m in Octave and hit Run. That gives the
error above. So Octave is not seeing the other file even though it is in
the same path. I am not sure why it is still not seeing it.
I am on a Mac but that should not make any difference or is it a file
permission issue?
Simon

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
get this file also
 DAS


 DAS

