J?rome Laurens <jerome.laurens at u-bourgogne.fr> writes:
> Hi list,
>
> How do you append arguments to an operator ?
> Given the list [a,b]
> how will you turn f(x,y) into f(x,y,a,b) ?
>
> Example:
>
> integrate(f(t),t) -> integrate(f(t),t,a,b)
>
> TIA
>
> J?r?me
The most general way is probably using apply:
Maxima branch_5_27_base_131_g811c7b3 http://maxima.sourceforge.net
using Lisp SBCL 1.0.57.0.debian
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) integrate(f(t),t);
/
[
(%o1) I f(t) dt
]
/
(%i2) args(%o1);
(%o2) [f(t), t]
(%i3) apply(integrate, append(args(%o1), [a,b]));
b
/
[
(%o3) I f(t) dt
]
/
a
(%i4)
If you know lisp, you should note that Maxima's apply is slightly
different from Common Lisp: it always takes one list of
arguments. Lisp's version would allow you to write something like
"apply(integrate, f(t), t, [a,b])". I only mention this because I spent
about twenty minutes banging my head against it a couple of days ago...
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120621/99fea483/attachment.pgp>