Bill Allombert on Thu, 08 Aug 2013 20:37:03 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Variable checker


On Thu, Aug 08, 2013 at 08:09:57PM +0200, Dirk Laurie wrote:
> 2013/8/7 Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>:
> 
> > My approach for this, would be to write a function
> >
> >   variables(expr)
> ...
> >     for (i = 1, #v, L = setunion(L, variables(v[i])));
> 
> 'setunion' is available in 2.5.1 too, but I can't get it to
> obey me.

In PARI 2.5, sets are more limited: they need to be constructed with Set()
which returns vector of strings.

? setunion(Set([a]),Set([x]))
%1 = ["a","x"]

You can then use eval to convert the strings to the original elements.

Cheers,
Bill.