1414 *
1515 */
1616public class Example4Old {
17- public static SymVector grad (Func f ) {
18- SymVector g = new SymVector ();
17+ public static ExprVector grad (Func f ) {
18+ ExprVector g = new ExprVector ();
1919 for (Expr arg : f .args ) {
2020 g .add (f .diff (arg ));
2121 }
2222 return g ;
2323 }
24- public static Expr dot (SymVector a , SymVector b ) {
24+ public static Expr dot (ExprVector a , ExprVector b ) {
2525 if (a .dim () != b .dim ())
2626 return null ;
2727 List <Expr > list = new ArrayList <Expr >();
@@ -40,8 +40,8 @@ public static Expr fdiff(Expr F, Expr f, Expr df) {
4040 }
4141
4242 //Functional grad
43- public static SymVector fgrad (Expr F , Expr [] fs , Expr [] dfs ) {
44- SymVector g = new SymVector ();
43+ public static ExprVector fgrad (Expr F , Expr [] fs , Expr [] dfs ) {
44+ ExprVector g = new ExprVector ();
4545 for (int i =0 ; i <fs .length ; i ++) {
4646 g .add (fdiff (F , fs [i ], dfs [i ]));
4747 }
@@ -66,15 +66,15 @@ public static void main(String[] args) {
6666 Func chi = new Func ("\\ chi " , x ,y ,z );
6767 Expr [] xs = new Expr []{u , lamd , q };
6868 Expr [] dxs = new Expr []{phi , psi , chi };
69- SymVector Lx = fgrad (L , xs , dxs );
69+ ExprVector Lx = fgrad (L , xs , dxs );
7070 System .out .println ("\n Gradient Lx = (Lu, Llamd, Lq) =" );
7171 System .out .println (Lx );
7272
7373 Func du = new Func ("\\ delta{u}" , x ,y ,z );
7474 Func dl = new Func ("\\ delta{\\ lambda}" , x ,y ,z );
7575 Func dq = new Func ("\\ delta{q}" , x ,y ,z );
7676 Expr [] dxs2 = new Expr [] { du , dl , dq };
77- SymMatrix Lxx = new SymMatrix ();
77+ ExprMatrix Lxx = new ExprMatrix ();
7878 for (Expr Lxi : Lx ) {
7979 Lxx .append (fgrad (Lxi , xs , dxs2 ));
8080 }
0 commit comments