vv

13405 Reputation

20 Badges

9 years, 144 days

MaplePrimes Activity


These are Posts that have been published by vv

Recently, a local Math olympiad included the following problem:

 

 

 Compute:Limit(n*(Int(x^n/(x^n+x+2024), x = 0 .. 1)), n = infinity).

 

 

I was almost sure that Maple can compute it, but unfortunately it needed help!

restart;

J:=n->n*int(x^n/(x^n+x+2024),x=0..1);

proc (n) options operator, arrow; n*(int(x^n/(x^n+x+2024), x = 0 .. 1)) end proc

(1)

limit(J(n), n=infinity); # Maple gives up.

limit(n*(int(x^n/(x^n+x+2024), x = 0 .. 1)), n = infinity)

(2)

simplify(IntegrationTools:-Change(J(n), x=t^(1/n), t)) assuming n>1;

int(t^(1/n)/(t+t^(1/n)+2024), t = 0 .. 1)

(3)

ans:=limit(%, n=infinity);

ln(2)+ln(1013)-4*ln(3)-2*ln(5)

(4)

#map(combine,ans, ln);

combine(ans,ln, integer);

4*ln((1/15)*2026^(1/4)*5^(1/2))

(5)

ln(exp(%)); # should be obtainable with convert

ln(2026/2025)

(6)

evalf(% = J(100)); # sanity check;

0.4937051076e-3 = 0.488824e-3+0.*I

(7)


Download lim-int-vv.mw

restart;

torus:= (x^2+y^2+z^2 + R^2-r^2)^2 - 4*R^2*(x^2+y^2):

torus1:=eval(torus,[r=1,R=4]);

(x^2+y^2+z^2+15)^2-64*x^2-64*y^2

(1)

plots:-implicitplot3d(torus1=0, x=-6..6,y=-6..6,z=-6..6, numpoints=5000, scaling=constrained, view=-2..2);

 

sol1:=solve(torus1<0, [x,y,z]); # It should be easy for Maple

[[x = 0, y < -3, -5 < y, z < (-y^2-8*y-15)^(1/2), -(-y^2-8*y-15)^(1/2) < z], [x = 0, y < 5, 3 < y, z < (-y^2+8*y-15)^(1/2), -(-y^2+8*y-15)^(1/2) < z]]

(2)

eval(torus1, [x=3,y=2,z=0]); # in the interior

-48

(3)

eval(sol1, [x=3,y=2,z=0]);   # ???

[[3 = 0, 2 < -3, -5 < 2, 0 < (-35)^(1/2), -(-35)^(1/2) < 0], [3 = 0, 2 < 5, 3 < 2, 0 < (-3)^(1/2), -(-3)^(1/2) < 0]]

(4)

 

 

Download Bug-solve_ineqs.mw

 

restart;

plots:-inequal([x^2+y^2<100, x+y>Pi]);      # ?,  evalf(Pi) ok

Error, (in ReasonableDomain:-Implicit) invalid input: ReasonableDomain:-Recorder:-AddPoint expects its 2nd argument, point, to be of type list(numeric), but received [Pi, 0]

 

plots:-inequal([x^2+y^2<100, x+y>sqrt(3)]); # ?

Error, (in ReasonableDomain:-Implicit) invalid input: ReasonableDomain:-Recorder:-AddPoint expects its 2nd argument, point, to be of type list(numeric), but received [3^(1/2), 0]

 

solve({x^2+y^2<100, x+y>Pi});               # ?

Warning, solutions may have been lost

 

solve({x^2+y^2<100, x+y>sqrt(10)});         # ?

Warning, solutions may have been lost

 

solve({x^2+y^2<100, x+y>4}, [x,y]);         # OK

[[x < 2+46^(1/2), 2-46^(1/2) < x, y < (-x^2+100)^(1/2), 4-x < y], [x = 2+46^(1/2), y < -2+46^(1/2), 2-46^(1/2) < y], [x < 10, 2+46^(1/2) < x, y < (-x^2+100)^(1/2), -(-x^2+100)^(1/2) < y]]

(1)

solve({x^2+y^2<100, x+y>a}, [x,y]) assuming 3<a, a<5;              #?

[]

(2)

solve({x^2+y^2<100, x+y>a}, [x,y], parametric) assuming 3<a, a<5;  # OK

[[x = (1/2)*a+(1/2)*(-a^2+200)^(1/2), (1/2)*a-(1/2)*(-a^2+200)^(1/2) < y, y < -(1/2)*a+(1/2)*(-a^2+200)^(1/2)], [(1/2)*a-(1/2)*(-a^2+200)^(1/2) < x, x < (1/2)*a+(1/2)*(-a^2+200)^(1/2), a-x < y, y < (-x^2+100)^(1/2)], [(1/2)*a+(1/2)*(-a^2+200)^(1/2) < x, x < 10, -(-x^2+100)^(1/2) < y, y < (-x^2+100)^(1/2)]]

(3)


Download bugs-irrationals.mw

About eliminate(...)

 

This post is motivated by a recent answer where I needed a necessary and sufficient condition for three straight lines in space be concurrent. I had to use determinants because the eliminate command did not provide the correct answer.
Investigating the cause, I saw that eliminate uses an heuristic algorithm, instead of using Groebner bases (when possible).


Here is an example.

We want to eliminate the unknowns x an y in the system

a*x + y = 0,  b*x+y+1 = 0, c*x+2*y = 0

 

sys:=[a*x + y, b*x + y + 1, c*x + 2*y];

[a*x+y, b*x+y+1, c*x+2*y]

(1)

eliminate(sys, [x,y]);

[{x = 0, y = 0}, {1}]

(2)

So, apparently, the elimination is not possible, i.e. for each triple (a,b,c), the system in x and y is incompatible.
This is not true. For example,

 

eval(sys,[a=1,b=3,c=2]);

[x+y, 3*x+y+1, 2*x+2*y]

(3)

eval(%, [x=-1/2, y=1/2]);

[0, 0, 0]

(4)

eliminate  obtained its result this way (just like a superficial human):

solve(sys[[1,3]], [x,y]);
eval(sys[2],%[]); # The result obtained by eliminate

[[x = 0, y = 0]]

 

1

(5)

Now, the correct result (also by hand):

solve(sys[[1,2]], {x,y});
eval(sys[3],%);
numer(simplify(%));

{x = 1/(a-b), y = -a/(a-b)}

 

c/(a-b)-2*a/(a-b)

 

c-2*a

(6)

So, for c = 2*a  (and a <> b)  the system in x,y  is compatible.

 

This result can be obtained with Groebner bases.

Groebner:-Basis(sys, plex(x,y,a,b,c));

[2*a-c, 2*b*y-c*y-c, c*x+2*y, b*x+y+1]

(7)

remove(has, %, {x,y});

[2*a-c]

(8)

Note that it is more efficient to use lexdeg([x,y], [a,b,c])  instead of plex(x,y,a,b,c).

Groebner:-Basis(sys, lexdeg([x,y], [a,b,c]));

[2*a-c, 2*b*y-c*y-c, c*x+2*y, b*x+y+1]

(9)

The conclusion is that eliminate should use internally Groebner:-Basis for polynomial systems.
Until then, we can use it ourselves!

 

Maple strings contain extended ASCII characters (codes 1..255). 
The international characters such as  î, ș, Å, Ø ,Ă, Æ, Ç are multi-byte encoded. They are ignored by the Maple engine but are known to the user interface which uses the UTF-8 encoding.
The package StringTools does not support this encoding. However it is not difficult to manage these characters using Python commands (included in the Maple distribution now).
Here are the UTF-8 versions of the Maple procedures length and substring.
You may want to improve these procedures, or to add new ones (my knowledge of Python is very limited).

LEN:=proc(s::string) Python:-EvalFunction("len",s) end proc:

SS:=proc(s::string, mn::{integer, range(({integer,identical()}))})
  local m,n;
  if type(mn,integer) then m,n := mn$2 else m:=lhs(mn); n:=rhs(mn) fi; 
  if m=NULL then m:=1 fi; if n=NULL then n:=-1 fi;
  if n=-1 then n:=LEN(s) elif n<0 then n:=n+1 fi;
  if m=-1 then m:=LEN(s) elif m<0 then m:=m+1 fi;
  Python:-EvalString(cat("\"",  s, "\"", "[", m-1, ":", n, "]"  ));
end proc:

LEN("Canada"), length("Canada");
                              6, 6

s:="România":
LEN(s), length(s);
                              7, 8

SS(s, 1..), SS(s, 1..-3), SS(s, 1..1), SS(s, -7..2), SS(s,1), SS(s,-1); 
            "România", "Român", "R", "Ro", "R", "a"

1 2 3 4 5 6 7 Page 1 of 7