In mathematics:
A ray is defined as a line that a has a starting point but no definite end point. It can be in any orientation and can form any angle
The sun ray:
It has a starting point which is the sun. However, it is hard to tell where each ray ends or fades. Besides, the rays of the sun can travel in any direction and form any angles
Comparing both, we would find that they are pretty much similar
Hope this helps :)