I’m trying to do a proof using trig identities, I get a fail, and I,m not sure if I’m using @test wrong, or if I made a mistake in my math s.t.
cos(x)-cos(y)=-2*(sin((x+y)/2)*sin((x-y)/2))
using Plots
using test
FX=f(x)=cos(x)
FY=f(y)=cos(y)
g(x,y)=abs(f(x)-f(y))
h(x,y)=-2*(sin((x+y)/2)*sin((x-y)/2))
delta(x,y)=abs(x-y)
plot(FX)
plot!(FY)
plot!(h)
Well, that is way beyond @tests abilities ( to show that two functions are the same), but you need to test that they are the same with ==. = is assignment.
(Pretty much any non-trivial calculation using floating variables will only have limited accuracy though, so you probably want to use isapprox instead of == here.)
Yes the dots are definitely part of the code. The dot syntax, for broadcasting, is a pretty essential part of the language. Please read the documentation for broadcasting to get a better idea of what’s going on.