hi
i follow Julia-'s help on http://docs.julialang.org/en/stable/manual/functions/ and i try to inderstand how functions work in Julia
i type this in a file that i run with an include
in the RPPL :
function f(x,y)
x + y
end
f(2,3)
it seems to work but Julia says :
WARNING: Method definition f(Any, Any) in module Main at /Users/vincentdouce/Desktop/Julia/vademecum_Julia.jl:16 overwritten at /Users/vincentdouce/Desktop/Julia/vademecum_Julia.jl:16.
i must admit i do not undestand at all what it means, and i pain to find any explanation on http://docs.julialang.org
about this point.
morehowever, i type this :
function f(x)
x*2
end
f(2,3)
and the result is 5.
i am ok that my script is wrong according to the number of variables of f, but why 5 ?
de plus je ne parviens pas du tout à comprendre comment tracer une famille de fonctions. Par exemple si je veux tracer les courbes f(x)=a.cos(x) pour a variant
j’ai essayé :
1 function f(x,y)
2 return(x*cos(y))
3 end
4
5 tvec = linspace(-π,π , 100)
6 for i=-5:5
7 plot!(tvec, f(i,tvec))
8 end
but the result is :
WARNING: Method definition f(Any, Any) in module Main at [line 2] overwritten at [line 2]
???
thanks for your help