I decided to take the derivative of tangent instead, which is sec^2 (this is also1/cos)
ps: this will look really broken unless you get rid of the scratch boundary... https://turbowarp.org/800421638?offscreen&hqpen