You are to do your homework without watching any TV.
The students are not to travel by subway without a friend.
Can't we also write these sentences like this:
You are going to do your homework without watching any TV.
The students are not going to travel by subway without a friend.
Is there a difference? I am not talking about just little difference like "less formal". And are there sentences where "be to do" can be used and "be going to do" cannot be used?
Is there an original similarity? Has "Going" fallen away over time? Or are these two completely different expressions?