HP Forums
Directional Derivative - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Directional Derivative (/thread-3853.html)



Directional Derivative - salvomic - 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


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



RE: Directional Derivative - Tonig00 - 05-11-2019 11:21 AM

Nice program.
It works.
Curious that DOT product should be written in lowercase letters. Also "local" seems to be necessary in lowercase.
Thanks