05-15-2015, 08:26 PM
hi all,
my proposal for a function to calculate directional derivative ( \( \bigtriangledown f \cdot \overrightarrow{v} \) ).
It's a CAS program. Use: derivdir(f,v), where f is a function and v a vector.
I would like to thank Han for his hints in making this program.
Enjoy!
Salvo
my proposal for a function to calculate directional derivative ( \( \bigtriangledown f \cdot \overrightarrow{v} \) ).
It's a CAS program. Use: derivdir(f,v), where f is a function and v a vector.
I would like to thank Han for his hints in making this program.
Enjoy!
Salvo
Code:
#cas
// Directional derivative: dot(grad(f0), normalize(v))
derivdir(f,v):=
BEGIN
local g:=grad(f,[x,y,z]);
// gradient
local w:=normalize(v);
// versor
m:=dot(g,w);
// dot product
return m;
END;
#end