## 10455 Reputation

6 years, 124 days

## MaplePrimes Activity

These are Posts that have been published by vv

## A riddle ! ...

Maple 2018

Can you guess what P() produces, without executing it?

P:=proc(N:=infinity) local q,r,t,k,n,l,h, f;
q,r,t,k,n,l,h := 1,0,1,1,3,3,0:
while h<N do
if 4*q+r-t < n*t
then f:=if(++h mod 50=0,"\n",if(h mod 10=0," ","")); printf("%d"||f,n);
q,r,t,k,n,l := 10*q,10*(r-n*t),t,k,iquo(10*(3*q+r),t)-10*n,l
else q,r,t,k,n,l := q*k,(2*q+r)*l,t*l,k+1,iquo(q*(7*k+2)+r*l,t*l),l+2
fi
od: NULL
end:


I hope you will like it (maybe after execution).

## Happy New Year!...

Maple
with(plots):
S:=cat("Happy New Year 2020!   "\$3):
N:=length(S): a:=0.77*Pi: h:=2*Pi/N:
display(seq(textplot([cos(a-k*h), sin(a-k*h),S[k+1]],
rotation=-Pi/2+a-k*h, 'font'=["times","roman",24]), k=0..N-4), axes=none);


## Putnam Mathematical Competition 2019...

Maple 2018

Maple can easily solve the B4 problem of the Putnam Mathematical Competition 2019  link

B4.  Let F be the set of functions f(x,y) that are twice continuously differentiable for x≥1, y≥1 and that satisfy the following two equations:

For each f2F, let

Determine m(f), and show that it is independent of the choice of f.

 > # Solution
 > pdsolve({ x*diff(f(x,y),x)+y*diff(f(x,y),y) = x*y*ln(x*y), x^2*diff(f(x,y),x,x)+y^2*diff(f(x,y),y,y) = x*y });
 (1)
 > f:=unapply(rhs(%[]), x,y);
 (2)
 > h := f(s+1, s+1) - f(s+1, s) - f(s, s+1) + f(s, s);
 (3)
 > minimize(h, s=1..infinity);
 (4)
 > answer = simplify(%);
 (5)
 >

## Algorithms...

Maple

There are no efficient algorithms for this.
How would you simplify by hand the expression

512*b^9 + (2303*a + 2304)*b^8 + (4616*a^2 + 9216*a + 4608)*b^7 + (5348*a^3 + 16128*a^2 + 16128*a + 5376)*b^6
+ (4088*a^4 + 16128*a^3 + 24192*a^2 + 16128*a + 4032)*b^5 + (1946*a^5 + 10080*a^4 + 20160*a^3 + 20160*a^2
+ 10080*a + 2016)*b^4 + (728*a^6 + 4032*a^5 + 10080*a^4 + 13440*a^3 + 10080*a^2 + 4032*a + 672)*b^3
+ (116*a^7 + 1008*a^6 + 3024*a^5 + 5040*a^4 + 5040*a^3 + 3024*a^2 + 1008*a + 144)*b^2
+ (26*a^8 + 144*a^7 + 504*a^6 + 1008*a^5 + 1260*a^4 + 1008*a^3 + 504*a^2 + 144*a + 18)*b + 9*a^8
+ 36*a^7 + 84*a^6 + 126*a^5 + 126*a^4 + 84*a^3 + 36*a^2 + 9*a + 1

to  (a+2*b+1)^9 - a*(a-b)^8   ?

## Putnam Mathematical Competition 2018...

Maple

Maple can solve the easiest two problems of the Putnam Mathematical Competition 2018.  link

Problem A1

Find all ordered pairs (a,b) of positive integers for which  1/a + 1/b = 3/2018

 > eq:= 1/a + 1/b = 3/2018;
 (1)
 > isolve(%);
 (2)
 > # Unfortunalely Maple fails to find all the solutions; eq must be simplified first!
 > (lhs-rhs)(eq);
 (3)
 > numer(%);
 (4)
 > s:=isolve(%);
 (5)
 > remove(u ->(eval(a,u)<=0 or eval(b,u)<=0),[s]);
 (6)
 > # Now it's OK.

Problem B1

Consider the set of  vectors  P = { < a, b> :  0 ≤ a ≤ 2, 0 ≤ b ≤ 100, a, b in Z}.
Find all v in P such that the set P \ {v} can be partitioned into two sets of equal size and equal sum.

 > n:=100: P:= [seq(seq([a,b],a=0..2), b=0..n)]:
 > k:=nops(P): s:=add(P): numsols:=0:
 > for i to k do   v:=P[i]; sv:=s-v;   if irem(sv[1],2)=1 or irem(sv[2],2)=1 then next fi;   cond:=simplify(add( x[j]*~P[j],j=1..k))-sv/2;   try     sol:=[];     sol:=Optimization:-Minimize          (0, {x[i]=0, (cond=~0)[], add(x[i],i=1..k)=(k-1)/2 }, assume=binary);     catch:   end try:   if sol<>[] then numsols:=numsols+1;      print(v='P'[i], select(j -> (eval(x[j],sol[2])=1), {seq(1..k)})) fi; od: 'numsols'=numsols;
 (7)
 >

Edit.
Maple can be also very useful in solving the difficult problem B6; it can be reduced to compute the (huge) coefficient of x^1842 in the polynomial

g := (1 + x + x^2 + x^3 + x^4 + x^5 + x^9)^2018;

The computation is very fast:

coeff(g, x, 1842):   evalf(%);

0.8048091229e1147

 1 2 3 4 5 6 Page 2 of 6
﻿