When he said that sec was 1/cos^2 I flipped and was so relieved when I realized it was a mistake and that I havent been coding that in wrong for years.,(reply>), @Konnor Porter That would make more sense!,(reply>), He was just saying that you can write the derivative of tan as 1/cos^2 instead of sec^2