HP Forums

Full Version: Directional Derivative
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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


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
Nice program.
It works.
Curious that DOT product should be written in lowercase letters. Also "local" seems to be necessary in lowercase.
Thanks
Reference URL's