I was wondering how to calculate if an M10 bolt can handle 400Nm of torque without shearing if its used to bolt a pipe on to a shaft which is connected to the gearbox?
Well it will depend on the wall thickness of the tube, I wouldn't recommend doing what you are doing and would say that the tube might fail before the bolt. In addition if the shaft is running at high speed you will have balance problems.
Can you give a more detailed explanation of what you are trying to achieve and we might be able to help further.
The bolt will be in double shear and the tube will possibly fail on bearing strength but without more info we cant really say.
“Do not worry about your problems with mathematics, I assure you mine are far greater.” Albert Einstein