Robert Israel

6577 Reputation

21 Badges

18 years, 215 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

Perhaps something like this?
> Zeroplus:= `#msub(mn("0"),mo("+"))`;
  Int(f(x), x=Zeroplus .. infinity);
And similarly, replacing plus with minus.
I can't really tell exactly what you want to do. Do you mean something like this?
with(plottools): with(plots):
P[0]:= implicitplot(x^2-y^2=1,x=-3..3,y=-3..3):
P[0];
for i from 1 to 5 do
  rotate(P[0],i*Pi/3,[0,0])
end do;
1) implicitplot is in the plots package. You either need
> with(implicitplot):
or
> plots[implicitplot](...);
2) You are using both [] and {} in the input. Those produce a list and a set respectively. You probably want to use parentheses ().
1) implicitplot is in the plots package. You either need
> with(implicitplot):
or
> plots[implicitplot](...);
2) You are using both [] and {} in the input. Those produce a list and a set respectively. You probably want to use parentheses ().
How many regions are produced by n lines in general position (no two parallel, no three coincident)? Note that the n'th line intersects each of the first n-1 lines in exactly one point, so splits in two exactly n of the regions created by the first n-1 lines. Thus the number of regions is R(n) = R(n-1) + n, with R(1) = 2, leading to
> simplify(rsolve({R(n)=R(n-1)+n, R(1)=2}, R(n)));
1/2*n+1/2*n^2+1 See also http://www.research.att.com/~njas/sequences/A000124
How many regions are produced by n lines in general position (no two parallel, no three coincident)? Note that the n'th line intersects each of the first n-1 lines in exactly one point, so splits in two exactly n of the regions created by the first n-1 lines. Thus the number of regions is R(n) = R(n-1) + n, with R(1) = 2, leading to
> simplify(rsolve({R(n)=R(n-1)+n, R(1)=2}, R(n)));
1/2*n+1/2*n^2+1 See also http://www.research.att.com/~njas/sequences/A000124
OK, that's clearer. You want to have a way to automatically generate a procedure with a given number of formal parameters. The basic pattern might be something like this, where the lower-level procedure q takes a list as argument. Note that _VARS and _BODY must be unassigned global variables.
> procgen:= proc(n) 
     local vars, x, i;
     vars := seq(cat(x,i),i=1..n);
     subs(_VARS = vars, _BODY = q([vars]), 
        proc(_VARS) _BODY end proc)
  end proc;
Then, for example:
> procgen(3);
proc (x1, x2, x3) q([x1, x2, x3]) end proc
OK, that's clearer. You want to have a way to automatically generate a procedure with a given number of formal parameters. The basic pattern might be something like this, where the lower-level procedure q takes a list as argument. Note that _VARS and _BODY must be unassigned global variables.
> procgen:= proc(n) 
     local vars, x, i;
     vars := seq(cat(x,i),i=1..n);
     subs(_VARS = vars, _BODY = q([vars]), 
        proc(_VARS) _BODY end proc)
  end proc;
Then, for example:
> procgen(3);
proc (x1, x2, x3) q([x1, x2, x3]) end proc
If L is a list of length n and t is a set of integers from 1 to n, applyop(`*`, t, L, -1) produces the list whose j'th element is -L[j] if j is in t, L[j] otherwise. In other words, you are applying the multiplication operator `*` with second argument -1 to those operands of L that are in t, while leaving the others alone. map(`<`, ..., 0) takes this list and transforms each element e to e < 0, so you now have a list of inequalities. Thus
 t ->  map(`<`, applyop(`*`,t,L,-1) , 0) 
is a function that takes the set t and returns the list of inequalities (+/-) L[i] < 0, using - for those i in t and + otherwise. Finally, with CPS a set of sets, the outer "map" applies this function to each member of CPS.
If L is a list of length n and t is a set of integers from 1 to n, applyop(`*`, t, L, -1) produces the list whose j'th element is -L[j] if j is in t, L[j] otherwise. In other words, you are applying the multiplication operator `*` with second argument -1 to those operands of L that are in t, while leaving the others alone. map(`<`, ..., 0) takes this list and transforms each element e to e < 0, so you now have a list of inequalities. Thus
 t ->  map(`<`, applyop(`*`,t,L,-1) , 0) 
is a function that takes the set t and returns the list of inequalities (+/-) L[i] < 0, using - for those i in t and + otherwise. Finally, with CPS a set of sets, the outer "map" applies this function to each member of CPS.
An indefinite-integral form of this, where g is the inverse function of f, and F an antiderivative of f, is int(g(y),y)=y*g(y)-F(g(y)) I don't know why Maple doesn't apply this formula to integrating a transcendental RootOf with respect to a linear parameter (it can integrate RootOf a polynomial). For example: int(RootOf(_Z*sin(_Z)-y),y) = y*RootOf(_Z*sin(_Z)-y)-sin(RootOf(_Z*sin(_Z)-y)) +RootOf(_Z*sin(_Z)-y)*cos(RootOf(_Z*sin(_Z)-y))
> combinat[powerset]({$1..5});
> combinat[powerset]({$1..5});
The reason you can't assign l after p is that after assigning p, one of the entries in l is 0=0 (which comes from k[1,2]=k[1,2]). You can't assign a value to 0 (even if that value is 0). I'm guessing that what you really want to do is assign those equations in l where the left side is something that can be assigned a value. So you might try
> assign(select(type, l, assignable=anything));
The reason you can't assign l after p is that after assigning p, one of the entries in l is 0=0 (which comes from k[1,2]=k[1,2]). You can't assign a value to 0 (even if that value is 0). I'm guessing that what you really want to do is assign those equations in l where the left side is something that can be assigned a value. So you might try
> assign(select(type, l, assignable=anything));
First 155 156 157 158 159 160 161 Last Page 157 of 187