In the case of the chaos program,
all the calculations can in fact
be done on the client side.
So the server can send the program code to the client and let the calculations be done there.
Here's a client-side version of the program.
This re-calculates the result whenever focus leaves input box.