vv

13877 Reputation

20 Badges

10 years, 0 days

MaplePrimes Activity


These are answers submitted by vv

restart;

f:=(x1,x2)->(x1-1/2)^4+x1*x2+2*x2^2-1;  
g:=(x1,x2)->(x1-sin(x1))^2+(x2-sin(x2))^2-1;

proc (x1, x2) options operator, arrow; (x1-1/2)^4+x1*x2+2*x2^2-1 end proc

 

proc (x1, x2) options operator, arrow; (x1-sin(x1))^2+(x2-sin(x2))^2-1 end proc

(1)

Find the circle of maximum radius that is tangent to both curves f=0, g=0.

 

Here is an approach using Optimization:-Maximize

It gives local maxima.

For a global maxima we must play with the intervals for variables and/or their initialpoint (using rand(...) conditions).

 

with(plottools):

pfg:=plots:-implicitplot([f(x,y),g(x,y)], x=-2..2,y=-2..2);

 

EQ:=
f(a,b)=0, g(c,d)=0, r2=(u-a)^2+(v-b)^2, r2=(u-c)^2+(v-d)^2,
D[1](f)(a,b) * (v-b) - D[2](f)(a,b) * (u-a) = 0,
D[1](g)(c,d) * (v-d) - D[2](g)(c,d) * (u-c) = 0:
rnd:=rand(-2. .. 2.):

unassign('a','b','c','d','u','v','r2');
sol:=Optimization:-Maximize( r2, {EQ}, u=-2..-1, v=-1.5..2, a=-5..0, b=-1..0, c=-2..-1, d=-2..-1, r2=0..3,
     initialpoint={u=0.7, v=0.5} )[2];
assign(sol);r:=sqrt(r2):
plots:-display(pfg,circle([u,v],r), plot([[a,b],[u,v]],color=red),plot([[c,d],[u,v]],color=blue),
               scaling=constrained,title=("Local max radius"=r));

[a = HFloat(-0.3036274461741274), b = HFloat(-0.46927384815579104), c = HFloat(-1.910428572753095), d = HFloat(-1.1755927491183271), r2 = HFloat(0.8409103269146442), u = HFloat(-1.0), v = HFloat(-1.0659107504612695)]

 

 

 

unassign('a','b','c','d','u','v','r2');
solglobmax:=[r2=0]:
to 200 do
ok:=true;
try
  sol:=Optimization:-Maximize( r2, {EQ}, initialpoint={u=rnd(), v=rnd()} )[2];
  catch:
  ok:=false;
end try;
if not ok then next fi;  
if eval(r2,sol)>eval(r2,solglobmax) then solglobmax:=sol fi;
od:
assign(solglobmax);r:=sqrt(r2):

plots:-display(pfg,circle([u,v],r), plot([[a,b],[u,v]],color=red),plot([[c,d],[u,v]],color=blue),
               scaling=constrained, title=("Global max radius"=r));

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

Warning, limiting number of major iterations has been reached

 

 

 

 

Download 2curves-vv.mw
(edited for Global max).

The constraints must be included in a set.

Optimization:-NLPSolve( TP_T(p1, p2), {C1, C2}, assume = nonnegative,  maximize );

 

diff( c * x / (1+x), x);

Optimization:-Maxima computes only local maxima.
In your case when computing the max in the interval {256.9131467 <= Pc, Pc <= 1436.173707},
Pc = 256.9131467  is a local maximal point. The global maximal point is of course Pc = 1436.173707.
If you want a global max (1-dimensiomal only!) you must use NLPSolve (and also method=branchandbound,   but it seems to be the default here).

When you meet such an aparent discrepancy you should look at a simple example; it is also much better to post a minimal example and with standard notations. Here is such an example:

f:=(x-2)^2:
Optimization:-Maximize(f, {1 <= x, x <= 5});
Optimization:-NLPSolve(f, x=1..5, maximize); # method=branchandbound);
plot(f, x=0..5);

                         [1., [x = 1.]]

                         [9., [x = 5.]]

C := C1 - C2 is a rational function (with 15 indeterminates). It will be enough to compute the minimal value for C and - C.
This can be obtained with the command  DirectSearch:-GlobalOptima(C, vars);
Here DirectSearch is a package which can be downloaded at https://www.maplesoft.com/Applications/Detail.aspx?id=101333

Actually, both min values are < 0, so, the answer to your question is that C1<C2 and C2<C1  are both false.
This can be seen directly (without DirectSearch) using:

P:=numer(normal(C1-C2)) / (lambda*varphi):
eval(-P, {Cm = 1, Cr = 10, Pu = 1, U = 2, a = 9, beta = 9, k = 10, lambda = 10, p1 = 1, tau0 = 10, upsilon = 10, varphi = 10, w = 10, varepsilon = 10, U[0] = 10});
#                     -63035971982554554000

eval(P, {Cm = 89, Cr = 65, Pu = 81, U = 50, a = 37, beta = 43, k = 44, lambda = 0, p1 = 85, tau0 = 74, upsilon = 75, varphi = 59, w = 62, varepsilon = 48, U[0] = 41});
#                       -19372211411803488

 

L := Sum((-1)^(k+1)/(floor(5*k*(1/2))-1), k = 1 .. infinity);
M := Sum(4*(-1)^(k+1)/(10*k+(-1)^k-5), k = 1 .. infinity);

Sum((-1)^(k+1)/(floor((5/2)*k)-1), k = 1 .. infinity)

 

Sum(4*(-1)^(k+1)/(10*k+(-1)^k-5), k = 1 .. infinity)

(1)

simplify(value(L)); # Maple needs help!

-(sum((-1)^k/(floor((5/2)*k)-1), k = 1 .. infinity))

(2)

a:=unapply(op(1,L),k ): b:=unapply(op(1,M),k ):

u:=simplify(a(2*n) + a(2*n-1)) assuming n::posint;
v:=simplify(b(2*n) + b(2*n-1)) assuming n::posint;

3/(25*n^2-25*n+4)

 

3/(25*n^2-25*n+4)

(3)

L = sum(u, n=1..infinity);  M=sum(v, n=1..infinity);

Sum((-1)^(k+1)/(floor((5/2)*k)-1), k = 1 .. infinity) = (1/5)*Pi*cot((1/5)*Pi)

 

Sum(4*(-1)^(k+1)/(10*k+(-1)^k-5), k = 1 .. infinity) = (1/5)*Pi*cot((1/5)*Pi)

(4)

 

 

Download LM-vv.mw

Maple cannot compute the limit, but your expression 
Sum(Sum(j/(j^2 + k^2), j = 1..n), k = 1..n) / n
is a Riemann sum of the double integral

int(y/(x^2+y^2), [x=0..1,y=0..1]);

         

and this is the result of the limit (not difficult to justify).

 

It seems that Maple does not like your problems. I do :-) 

 

Problem 1.

restart

sum(x^(2^k)/product(x^(2^m) + 1, m = 0 .. k), k = 0 .. infinity) assuming x>1;

sum(x^(2^k)/(product(x^(2^m)+1, m = 0 .. k)), k = 0 .. infinity)

(1)

So, this does not work. Amplifying the fraction by  x-1

Workaround:   Amplifying the fraction by  x-1 ==>

sum(x^(2^k)/product(x^(2^m) + 1, m = 0 .. k), k = 0 .. infinity) =
sum(x^(2^k)*(x - 1)/(x^(2^(k + 1)) - 1), k = 0 .. infinity);

sum(x^(2^k)/(product(x^(2^m)+1, m = 0 .. k)), k = 0 .. infinity) = sum(x^(2^k)*(x-1)/(x^(2^(k+1))-1), k = 0 .. infinity)

(2)

The main ingredient is the identity:

sum(x^(2^k)*(x - 1)/(x^(2^(k + 1)) - 1), k = 0 .. n) = (x^(2^(n + 1)) - x)/(x^(2^(n + 1)) - 1);

sum(x^(2^k)*(x-1)/(x^(2^(k+1))-1), k = 0 .. n) = (x^(2^(n+1))-x)/(x^(2^(n+1))-1)

(3)

This can ve checked by induction. Finally:

 

map(limit, %, n=infinity) assuming x>1;

sum(x^(2^k)*(x-1)/(x^(2^(k+1))-1), k = 0 .. infinity) = 1

(4)

Problem 2.

 

S:=Sum(Sum(1/i,i=1..n)/n/(n+1), n=1..infinity);

Sum((Sum(1/i, i = 1 .. n))/(n*(n+1)), n = 1 .. infinity)

(5)

S = value(S);

Sum((Sum(1/i, i = 1 .. n))/(n*(n+1)), n = 1 .. infinity) = sum((Psi(n+1)+gamma)/(n*(n+1)), n = 1 .. infinity)

(6)

So, Maple practically also fails.

 

Here it is enough to change the summation order (legit, because the summands are positive).

 

Sum(Sum(1/i/n/(n+1), n=i..infinity), i=1..infinity);

Sum(Sum(1/(i*n*(n+1)), n = i .. infinity), i = 1 .. infinity)

(7)

S = value(%);

Warning, unable to determine if the summand is singular in the interval of summation (1 <= i or not); try to use assumptions or option 'parametric'

 

Sum((Sum(1/i, i = 1 .. n))/(n*(n+1)), n = 1 .. infinity) = (1/6)*Pi^2

(8)

It is interesting that the warning disappears if we execute the last command once more!NULL


Download test12-vv.mw

B:=(4*exp(x/2) - 3*x - 2*exp(x/3)+1)^11 + (4*exp(x/2) + x - 2*exp(x/3)+1)^11 - 13:
A:=combine(expand(B)):
A1:=simplify(A, size): B1:=simplify(B, size):
length~([A, B, A1, B1]);
MmaTranslator:-Mma:-LeafCount~([A, B, A1, B1]);                   

                    [6209, 120, 3487, 120]

                      [1539, 38, 976, 38]

It will be very difficult (no algorithms available) to simplify A to B.  For the other software too!

eval(A-B, x=2*t):
simplify(factor(expand(%))) assuming real;

                     0

Maple 2024 does not solve the problem.
Here is a workaround:

convert(series((f:=(lhs-rhs)(eq)),t,16),polynom):
solve([coeffs(%,t)]);
eval(f,%); #check

        {A[1]=0, A[2]=0, A[3]=-7/25, A[4]=1/25, A[5]=-2/5, A[6]=1/5, A[7]=3/16, A[8]=0, A[9]=0, A[10]=3/8}
        0

f := n -> (ln(x)^n)^(1/n);

simplify(f(2))  returns  csgn(ln(x))*ln(x)
just because the "simple" function  csgn exists.  csgn(z) equals sqrt(z^2)/z for z<>0.

simplify(f(3))  remains unsimplified because a similar "sign" function does not exist for z^(1/3);

For n = 3 or n=5,  simplify((log(x)^n)^(1/n)) assuming x::positive, x<1   give both  - ln(x) * (-1)^(1/n)
but when n=3,   (-1)^(1/3)   is further simplified to 1/2+I*sqrt(3)/2; 
When n=5, it would be too complicated:  (-1)^(1/5) = sqrt(5)/4 + 1/4 + sqrt(2)*sqrt(5 - sqrt(5))*I/4.

odetest cannot work with such generalized series. But it is easy to test the solution directly: 

fsol:=series(rhs(maple_sol), x=0):
# series(eval(lhs(ode), y(x)=fsol), x);  # O(x^5)
map(series, map(eval, ode, y(x)=fsol), x)

          O(x^5) = 0

restart;

X,Y := t->5*cos(t), t->(5+sin(6*t))*sin(t):

with(plots):

P0:=plot([X,Y, 0..2*Pi], color=black):

T:=D(Y)/D(X): # the sloap of the tangent

K:=unapply(VectorCalculus:-Curvature(<X(t),Y(t)>),t):

tt[1],tt[2] := eval( [a,b], fsolve({T(a)-T(b), K(a)-K(b)}, {a, b}, {a=0..1, b=3..5}) )[];

.5465721754, 4.440166423

(1)

tt[3],tt[4] := eval( [a,b], fsolve({T(a)-T(b), K(a)-K(b)}, {a, b}, {a=2..2.5, b=3..6}) )[];

2.168601832, 3.704639334

(2)

tt[5],tt[6] := eval( [a,b], fsolve({T(a)-T(b), K(a)-K(b)}, {a, b}, {a=2.5..3, b=3..6}) )[];

2.845163972, 5.737842021

(3)

col:=[red$2,blue$2,green$2]:

curvatures=seq(K(tt[i]),i=1..6)

curvatures = (1.391345054, 1.391345047, 1.111111250, 1.111111261, 0.3791851261e-1, 0.3791851136e-1)

(4)

display(P0,
        seq( pointplot([[X(tt[i]),Y(tt[i])]], color=col[i]), i=1..6),
        seq( plot(T(tt[i])*(x-X(tt[i])) + Y(tt[i]), x=-40..40, color=col[i]), i=1..6),
        symbolsize=24, symbol=solidcircle, scaling=unconstrained, view=[-7..7,-7..7],gridlines=false
);

 

 


 

Download equal-sloap-curvature-vv.mw

The correct syntax for rsolve is:

sol := rsolve({f(n)=sin(f(n-1)), f(0)=a}, f(n));

(sin@@n)(a)

(1)

Unfortunately Maple cannot compute the following "classical" limit directly:

 

limit(sol*sqrt(n/3), n=infinity) assuming a>0,a<Pi;

limit((1/3)*(sin@@n)(a)*3^(1/2)*n^(1/2), n = infinity)

(2)

However, it can more than this: it is able to compute the asymptotic expansion!

 

asympt('rsolve'({f(0) = a, f(n) = sin(f(n - 1))}, f(n)), n);

3^(1/2)*(1/n)^(1/2)+(_C-(3/10)*3^(1/2)*ln(n))*(1/n)^(3/2)+O((1/n)^(5/2))

(3)

So, the limit is 1.

Note however that this is a generic result; for its validity we must add a condition e.g. 0<a, a<Pi.

1 2 3 4 5 6 7 Last Page 2 of 120