Your tangent equation at #pi/4# is:
#y-f(pi/4)=f'(pi/4)(x-pi/4)#
so to find the tangent, you need to find #f(pi/4)# and #f'(pi/4)#
Finding #f(pi/4)#:
for #x=pi/4#, #f(pi/4)=e^(-pi^2/16) - sin3pi/4#
#=>f(pi/4)=e^(-pi^2/16) -sqrt2/2#
Finding #f'(pi/4)#:
#f'(x)=-2xe^(-x^2)-3cos3x#
for #x=pi/4#, #f'(pi/4)=-2pi/4e^(-pi^2/16) -3cos3pi/4#
#=> f'(pi/4)=-pi/2e^(-pi^2/16) - 3(-sqrt2/2)#
#=> f'(pi/4)=-pi/2e^(-pi^2/16) + 3sqrt2/2#
After all, you put what you found into your tanget function, so you get:
#y-e^(-pi^2/16) + sqrt2/2 =( -pi/2e^(-pi^2/16) + 3sqrt2/2)(x-pi/4)#
#=>y=x(-pi/2e^(-pi^2/16) +3sqrt2/2)+pi^2/8e^(-pi^2/16) -3pisqrt2/8+e^(-pi^2/16)-sqrt2/2#
Where the green line is your f(x), yellow line is the tangent of #pi/4#