I know this is an old question, but it's worth noting that some people have been doing automated conversions of physics libraries over from ActionScript to JS (using eg. Python for the parsing). I'm not saying it's an easy task, but it has to be easier than writing your own math libraries from scratch, so I guess this may be a possibility for some.