Seemingly a homework, maybe one which is written to cause a little uncomfort for those who have skipped the elementaries.
If the result must be a pattern generating code which is programmed with certain tools and use certain algorithms to make the starting pattern, the things are different. I generate only a pattern.
W(x,y) obviously is the color content of one dot in coordinates (x,y). Thus you can select freely (or obeying those limitations that you have got but not revealed) what you have in a rectangle which starts from corner (0,0) and is N0 pixels wide and N1 pixels high. The opposite corner for (0,0) has pixel coordinates (N0-1, N1-1)
In Photoshop you make an image which is exactly = starting rectangle, put into it noise, a sample of another image, filter it or populate it otherwise obeying those rules which you have got but not revealed.
An example: N0=60,N1=34, the content = random text, random part of a random photo, color noise.
Then you select all and define it to be a custom pattern (Edit > Define Pattern). Make another image and fill it with that pattern. Use pattern brush and fill your image with a single stroke
A 3000px wide image is filled with the pattern brush. It was one fast sweep forth and back because the brush was 2000 px wide.
The result has shifted edges i.e. the original (0,0) corner isn't exactly at (0,0) in the filled image. That doesn't harm, the periodicity equations are still satisfied.