Mathc initiation/Fichiers c : c28cg
Installer et compiler ces fichiers dans votre répertoire de travail.
c16g.c |
---|
/* --------------------------------- */
/* save as c16g.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fe.h"
/* --------------------------------- */
int main(void)
{
double h = .01;
pt2d p = i_pt2d(2,0);
v2d u = grad_fxy(f,h,p);
v2d mns_u = mns_u2d(u);
v2d v = normalize2d(mns_u);
clrscrn();
printf(" f : x,y-> %s\n\n\n",feq);
printf(" Find a unit vector in the direction \n" );
printf(" in which f decreases most rapidly at p(%+.1f,%+.1f)\n\n\n",p.x,p.y);
printf(" -grad f(x,y)]p = %+.3fi %+.3fj \n\n\n",mns_u.i,mns_u.j);
printf(" v = u / ||u|| = %+.3fi %+.3fj \n\n",v.i,v.j);
printf(" which is a unit vector in the direction in which f \n");
printf(" decreases most rapidly at p(%+.1f,%+.1f)\n\n\n",p.x,p.y);
printf(" and the rate of change in that direction is -||grad f(x,y)]p||\n\n");
printf(" -||u|| = %+.3f \n\n\n",-norm2d(u));
stop();
return 0;
}
/* --------------------------------- */
Dérivée directionnelle (Directional derivative)
En analyse mathématique, la notion de dérivée directionnelle permet de quantifier la variation locale d'une fonction dépendant de plusieurs variables, en un point donné et le long d'une direction donnée dans l'espace de ces variables.
Exemple de sortie écran :
f : x,y-> x**2 * exp(-2*y)
Find a unit vector in the direction
in which f decreases most rapidly at p(+2.0,+0.0)
-grad f(x,y)]p = -4.000i +8.001j
v = u / ||u|| = -0.447i +0.894j
which is a unit vector in the direction in which f
decreases most rapidly at p(+2.0,+0.0)
and the rate of change in that direction is -||grad f(x,y)]p||
-||u|| = -8.945
Press return to continue.