List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Nargs
| [MUG] Nargs |
|
Author: PierLuigi Zezza
Posted: Mon, 16 Dec 2002 22:36:45 +0100
|
>> From: PierLuigi Zezza "pzezza"
I am constructing (Maple >= 5 release 5) a procedure which has a function
(procedure) as an input and I want to detect the number of arguments of the
input.
I tried with
> myproc:=proc(f::procedure) nops({op(1,eval(f))}) end;
myproc := proc(f::procedure) nops({op(1, eval(f))}) end proc
so that
> f:=x->x^2-1;
2
f := x -> x - 1
> myproc(f);
1
> F:=(x,y)->x^2;
2
F := (x, y) -> x
> myproc(F);
2
but I would like to have has input also linear combinations or composition
of functions as
> g:=x->(x+1);
g := x -> x + 1
> (2*f-g)(x);
2
2 x - 3 - x
and
> h:=t->(t^2,t);
2
h := t -> (t , t)
> (f@h)(t);
4
t - 1
but my procedure does not work and I think that the reason is that
> type(2*f-g,procedure);
false
> type(f@h,procedure);
false
and hence
> op(1,eval(f@h));
f
> op(1,eval(2*f-g));
2 f
while
> op(1,eval(F));
x, y
any suggestion is welcome
gigi zezza
PierLuigi Zezza
"pzezza"
|
[View Complete Thread]
Previous by date: [MUG] dsolve does not find second solution, Helmut Kahovec
Next by date: [MUG] how to implicitplot this func, Ruan Zhichao
Previous thread: [MUG] Evaluation problem, Colin Campbell - IST
Next thread: [MUG] how to implicitplot this func, Ruan Zhichao
|