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,
would like anybody to help me to get a program for Directional Derivative?
Starting with this: it's the dot product between Gradient of v and person of u, ( {tex} \( \bigtriangledown f \cdot \overrightarrow{v} \) {/tex} ) so
dot (grad(u) , v/normalize(v)) could be good, but if use it with "Define" it doesn't works, as "dot" (lowercase) is always changed in "DOT" (uppercase) and the function gives error "dot vector Error: bad argument value"...

(I'm using CAS)

Thank you in advance!

Salvo
I'm trying this program:

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

It seems to works with f as a function (expression), f(0), like (x^2-x*y) and v as vector (also not normalized), like [3,4] or [x,3y]; the program first normalize the vector finding its versor, and then return the symbolic directional derivative in the direction of that vector...

Any help to make it better?
There is a way to have the function listed in the Toolbox -> User?

Thank you :-)

salvo
(01-29-2015 04:36 PM)salvomic Wrote: [ -> ]There is a way to have the function listed in the Toolbox -> User?

Thank you :-)

salvo

Make a non-CAS wrapper.

DDER(f,v)
BEGIN
derivdir(f,v);
END;

Since DDER is a non-CAS program, you would then have to enter your arguments as strings:

DDER("x^2*y+z","[3,4,1]");
(01-29-2015 06:57 PM)Han Wrote: [ -> ]Make a non-CAS wrapper.

DDER(f,v)
BEGIN
derivdir(f,v);
END;

Since DDER is a non-CAS program, you would then have to enter your arguments as strings:

DDER("x^2*y+z","[3,4,1]");

I'll try, thank you Han!
Reference URL's