vv

12453 Reputation

19 Badges

9 years, 279 days

MaplePrimes Activity


These are replies submitted by vv

@lcz Not like this. A compilable procedure is very restrictive. It cannot contain maple structures (except rtable with hardware entries) , so it must be written from scratch, starting e.g. from the adjacency matrix of the graph.

@Carl Love Maybe with a more flexible input:

CyclSum:= proc(f::{procedure,algebraic}, x::{indexed(posint),list(name)})
    local j,k,n,t,g;
    if x::list then t:=x; n:=nops(x)  else t:=op(0,x); n:=op(1,x) fi;
    if f::procedure then g:=f elif x::list then g:=unapply(f,x) else error "2nd param must be a list here" fi; 
    add(g(seq(t[1+irem(j+k-2, n)], j= 1..n)), k= 1..n)
end:

CyclSum((x,y)->x^y, [x,y,z]);

CyclSum(x^y, [x,y,z]);

CyclSum( () -> args[1]^p*args[2]^q, x[7]);

@Carl Love I wonder what would be a functional procedure for constructing a cyclic sum associated to an arbitrary expression, i.e.  Sum( f(x[s(1)], ..., x[s(n)]), s in Cycl(n) ) ,  where Cycl(n) contains the n cyclic permutations of {1, ..., n}.

[ Probably you will enjoy to write it :-) ]

For symmetric polynomials, any such polynomial can be expressed as a polynomial in the symmetric fundamental sums [probably you used the term "basis" for these].
For n=3 variables (let's restrict the question for this case), these are x+y+z, x*y+y*z+z*x and x*y*z.
They are cyclic (for n=3) but obvbiously only symmetric polynomials can be obtained this way.

Probably there is not a finite set of "fundamental" cyclic polynomials. But for an infinite set, it is not difficult to see that your set of polynomials  union {x*y*z}  forms a "fundamental" set. 

Do you mean a basis in the vector space of cyclic polynomials with rational coefficients (say)?
In this case the answer is yes, because your polynomials are linearly independent.

@C_R  Rouben forgot to include:

addcoords(z_cylindrical,[z, r,theta],[r*cos(theta),r*sin(theta),z]);

For a unique solution, you will need to define a well-order (see wiki). 

The attachment contains an image hint. (For the moment mapleprimes refuses to inline it).

pic1.zip

@acer  For testing (without modifying the polygon) it is indeed more convenient to use clicks. In this case, it is enough to replace 

Explore(T(x,y), x=0..80, y=0..100);

with

Explore(T(x,y), x=0..80, y=0..100, markers=[[x,y]]);

@Carl Love I always enjoy your optimized but too cryptic (for my taste) procedures!

You cannot omit the early return when P is in L, otherwise the result will be wrong in most cases.

@acer  Nice. Unfortunately the blue point cannot be dragged over the boundary, so, the undefined value cannot be tested.

@mmcdara Here is a test using Explore. For older versions of Maple, use the previous Wind.

restart;
Wind:=proc(L::listlist, P::list)
  local p,u,k, x0:=P[1],y0:=P[2], t;
  if member(P,L) then return undefined fi;
  u:=seq(arctan(p[2]-y0,p[1]-x0),p=L); if L[1]<>L[-1] then u:=u,u[1] fi;
  add(piecewise(abs((t:=u[k+1]-u[k]))=Pi,undefined, t<-Pi,+1, t>Pi,-1, 0), k=1..nops([u])-1)
end:
K:=[[10,10], [10,90], [70,90], [70,50], [30,50], [30,30], [60,30], [60,80], [20,80], [20,70], [40,70], [40,40], [20,40], [20,60], [50,60], [50,10], [10,10]]:
T:=proc(x,y)  local w:=Wind(K, [x,y]);
  uses plots;
  display(plottools:-polygon(K),color=yellow,linestyle=solid,thickness=2, 
    pointplot(K, color=red, symbolsize=16, symbol=solidcircle),
    pointplot([x,y], color=blue, symbolsize=16, symbol=solidbox),
    view=[0..80, 0..100], title=typeset([x,y],'wind'=w));
end:
Explore(T(x,y), x=0..80, y=0..100);

@Rouben Rostamian  

alpha_max / Pi  is one of the real roots of the polynomial

9*t^6 - 54*t^5 + 48*t^4 + 168*t^3 - 336*t^2 + 192*t - 32

restart;

R1:=alpha/(2*Pi): h1:=sqrt(1-R1^2): V1:=Pi*R1^2*h1/3:

V := V1 + eval(V1, alpha=2*Pi-alpha);

(1/24)*alpha^2*(-alpha^2/Pi^2+4)^(1/2)/Pi+(1/24)*(2*Pi-alpha)^2*(-(2*Pi-alpha)^2/Pi^2+4)^(1/2)/Pi

(1)

#plot(V, alpha=0..Pi);

plot(V, alpha=Pi/4..Pi);

 

sol:=maximize(V, alpha=0..Pi, location):

evalf(sol)

.4566405910, {[{alpha = 2.035839071}, .4566405910]}

(2)

alpha__max:=eval(alpha, sol[2][][1]);

Pi-(1/3)*Pi*(29-4*43^(1/2)*cos((1/3)*arctan((9/1121)*191^(1/2)))-4*3^(1/2)*43^(1/2)*sin((1/3)*arctan((9/1121)*191^(1/2))))^(1/2)

(3)

evalf(alpha__max*180/Pi); # degrees

116.6449865

(4)

 

 

@nm A much larger maxslope:=100000:  is probably acceptable in most non-pathological cases.

First 13 14 15 16 17 18 19 Last Page 15 of 166