Sponsored links: Algebra eBooks
 

Related

funmake

f (x, y) := y^2 - x^2;

funmake (f, [a + 1, ...

''%;

Calculate

funmake

F (x, y) := y^2 - x^2;

funmake (F, [a + 1, ...

''%;

Calculate

funmake

f (x, y) := y^2 - x^2;

funmake (f, [a + 1, ...

''%;

Calculate

funmake

F (x, y) := y^2 - x^2;

funmake (F, [a + 1, ...

''%;

Calculate

funmake

Run Example
(%i1)load ("scifac") ;
(%o1)      /usr/share/maxima/5.21.1/share/simplification/scifac.lisp
(%i2) load("abs_integrate") ;
(%o2) /usr/share/maxima/5.21.1/share/contrib/integration/abs_integrate.mac
(%i3) load("fourie") ;
(%o3)         /usr/share/maxima/5.21.1/share/calculus/fourie.mac
(%i4) nc_factor(e):= block([opsubst: true],  subst(lambda([[L]], apply(nc_factor_aux, L)), "+", e));
(%o4) nc_factor(e) := block([opsubst : true], 
                         subst(lambda([[L]], apply(nc_factor_aux, L)), "+", e))
(%i5) dotassoc  : false;
(%o5)                                false
(%i6) dotdistrib: false;
(%o6)                                false
(%i7) dot2tic_tac(e):= block([inflag: true],  if safe_op(e)#"." then error("op(e) shoule be '.'"),  if length(e)#2 then error("the number of arguments should be 2"),  funmake('tic, [first(e)])*funmake('tac, [second(e)]));
(%o7) dot2tic_tac(e) := block([inflag : true], 
if safe_op(e) # "." then error("op(e) shoule be '.'"), 
if length(e) # 2 then error("the number of arguments should be 2"), 
funmake('tic, [first(e)]) funmake('tac, [second(e)]))
(%i8) tic_tacify(e):= block([op: safe_op(e), inflag: true, seen_dot: false, prederror: true],  if op="." then dot2tic_tac(e)  else if op="*" then map(lambda([el],      if not seen_dot and op="." then (seen_dot: true, dot2tic_tac(el)) else el), e)  else e);
(%o8) tic_tacify(e) := block([op : safe_op(e), inflag : true, 
seen_dot : false, prederror : true], if op = "." then dot2tic_tac(e)
 else (if op = "*" then map(lambda([el], 
if (not seen_dot) and (op = ".") then (seen_dot : true, dot2tic_tac(el))
 else el), e) else e))
(%i9) ntic_or_ntac(e):= is(not funp('tic, e) or not funp('tac, e));
(%o9)  ntic_or_ntac(e) := is((not funp('tic, e)) or (not funp('tac, e)))
(%i10) de_tic_tacify_aux(e):= block([fst: 1, scn: 1, rst: 1, inflag: true, prederror: true],  for el in e do (if funp('tic, el) then fst: remfun('tic, el)    else if funp('tac, el) then scn: remfun('tac, el)    else rst: rst*el),  rst*(fst . scn));
(%o10) de_tic_tacify_aux(e) := block([fst : 1, scn : 1, rst : 1, 
inflag : true, prederror : true], for el in e do if funp('tic, el)
 then fst : remfun('tic, el) else (if funp('tac, el)
 then scn : remfun('tac, el) else rst : rst el), rst (fst . scn))
(%i11) de_tic_tacify(e):= block([inflag: true, prederror: true, op: safe_op(e)],  if op="*" and every(ntic_or_ntac, args(e)) then de_tic_tacify_aux(e)  else if op#false then map('de_tic_tacify, e)  else e);
(%o11) de_tic_tacify(e) := block([inflag : true, prederror : true, 
op : safe_op(e)], if (op = "*") and every(ntic_or_ntac, args(e))
 then de_tic_tacify_aux(e) else (if op # false then map('de_tic_tacify, e)
 else e))
(%i12) nc_factor_aux([L]):= block([M, op],  M: map('tic_tacify, L),  M: factorsum(factor(apply("+", M))),  de_tic_tacify(M));
(%o12) nc_factor_aux([L]) := block([M, op], M : map('tic_tacify, L), 
                        M : factorsum(factor(apply("+", M))), de_tic_tacify(M))
(%i13) load("multiadditive") ;
(%o13)     /usr/share/maxima/5.21.1/share/contrib/multiadditive.lisp
(%i14) 
Run Example
? funmake;

 -- Function: funmake (<F>, [<arg_1>, ..., <arg_n>])
     Returns an expression `<F>(<arg_1>, ..., <arg_n>)'.  The return
     value is simplified, but not evaluated, so the function <F> is not
     called, even if it exists.

     `funmake' does not attempt to distinguish array functions from
     ordinary functions; when <F> is the name of an array function,
     `funmake' returns `<F>(...)' (that is, a function call with
     parentheses instead of square brackets).  `arraymake' returns a
     function call with square brackets in this case.

     `funmake' evaluates its arguments.

     Examples:

     `funmake' applied to an ordinary Maxima function.

          (%i1) F (x, y) := y^2 - x^2;
                                             2    2
          (%o1)                  F(x, y) := y  - x
          (%i2) funmake (F, [a + 1, b + 1]);
          (%o2)                    F(a + 1, b + 1)
          (%i3) ''%;
                                        2          2
          (%o3)                  (b + 1)  - (a + 1)

     `funmake' applied to a macro.

          (%i1) G (x) ::= (x - 1)/2;
                                            x - 1
          (%o1)                    G(x) ::= -----
                                              2
          (%i2) funmake (G, [u]);
          (%o2)                         G(u)
          (%i3) ''%;
                                        u - 1
          (%o3)                         -----
                                          2

     `funmake' applied to a subscripted function.

          (%i1) H [a] (x) := (x - 1)^a;
                                                  a
          (%o1)                   H (x) := (x - 1)
                                   a
          (%i2) funmake (H [n], [%e]);
                                                 n
          (%o2)               lambda([x], (x - 1) )(%e)
          (%i3) ''%;
                                              n
          (%o3)                       (%e - 1)
          (%i4) funmake ('(H [n]), [%e]);
          (%o4)                        H (%e)
                                        n
          (%i5) ''%;
                                              n
          (%o5)                       (%e - 1)

     `funmake' applied to a symbol which is not a defined function of
     any kind.

          (%i1) funmake (A, [u]);
          (%o1)                         A(u)
          (%i2) ''%;
          (%o2)                         A(u)

     `funmake' evaluates its arguments, but not the return value.

          (%i1) det(a,b,c) := b^2 -4*a*c;
                                              2
          (%o1)              det(a, b, c) := b  - 4 a c
          (%i2) (x : 8, y : 10, z : 12);
          (%o2)                          12
          (%i3) f : det;
          (%o3)                          det
          (%i4) funmake (f, [x, y, z]);
          (%o4)                    det(8, 10, 12)
          (%i5) ''%;
          (%o5)                         - 284

     Maxima simplifies `funmake''s return value.

          (%i1) funmake (sin, [%pi / 2]);
          (%o1)                           1


(%o1)                                true
(%i2) 
Run Example
F (x, y) := y^2 - x^2;
                                          2    2
(%o1)                         F(x, y) := y  - x
(%i2)  funmake (F, [a + 1, b + 1]);
(%o2)                           F(a + 1, b + 1)
(%i3)  ''%;
(%o3)              G (x) ::= (x - 1)/2;
 funmake (G, [u]);
                                         x - 1
(%o4)                           G(x) ::= -----
                                           2
(%i5)  ''%;
(%o5)                                G(u)
(%i6)  H [a] (x) := (x - 1)^a;
(%o6)             (%i7)  funmake (H [n], [%e]);
                                               a
(%o7)                          H (x) := (x - 1)
                                a
(%i8)  ''%;
                                              n
(%o8)                      lambda([x], (x - 1) )(%e)
(%i9)  funmake ('(H [n]), [%e]);
(%o9)             (%i10)  ''%;
(%o10)                              H (%e)
                                     n
(%i11)  funmake (A, [u]);
(%o11)            (%i12) (%i12) (%o12)                               A(u)
(%i13)  ''%;
(%o13)             det(a,b,c) := b^2 -4*a*c;
(%i14)                                            2
(%o14)                    det(a, b, c) := b  - 4 a c
 (x : 8, y : 10, z : 12);
(%i15) (%o15)                                12
 f : det;
 funmake (f, [x, y, z]);
(%o16)                                det
(%i17) (%i17) (%o17)                          det(8, 10, 12)
 ''%;
 funmake (sin, [%pi / 2]);
(%o18)            (%i19) 

Related Help

Help for Funmake