Message Boards Message Boards


Math one-liners from YouTube

Posted 4 months ago
8 Replies
10 Total Likes

There are some daily Youtubers who write out their symbolic solutions to a short straight-forward (non-quiz like type) math problem. Oftentimes Mathematica can solve those problems too. Maybe we could share here the ones which our software cannot solve easily?


Let me go first. In the "Putnam Exam 2004 | B5" video the youtuber claims that $L = \frac{2}{e}$ $$L=\lim_{x\to 1^-} \prod _{n=0}^{\infty } \left(\frac{1+x^{n+1}}{1+x^n}\right)^{x^n}=\ldots =\frac{2}{e}$$

Imho the Wolfram L code for this expression should be:

Limit[Product[((1 + x^(n + 1))/(1 + x^n))^(x^n), {n, 0, Infinity}], x -> 1, Direction -> "FromBelow"]

However, Mathematica computes forever without returning a result, i must abort the computation. Maybe my code line is wrong, can you get the desired result?

Obviously this (hopefully collective) thread (feel free to memorize the short-URL, if you can't follow/subscribe to the thread for updates) is nothing urgent. It is entertaining to let Mathematica have a crack at such symbolic math problems which get ten thousands of views within a week. Thanks for taking an interest!

8 Replies
Table[NProduct[((1 + x^(n + 1))/(1 + x^n))^(x^n), {n, 0, Infinity}, 
  WorkingPrecision -> 15], {x, .99999999, 1, .000000001}]

looks like it goes to 2/e.

To give you a hint to look for something over e,

Limit[Product[((x^(n + 1))/(x^n))^(x^n), {n, 0, Infinity}], x -> 1, 
 Direction -> "FromBelow"]

quickly gives 1/e.


2nd problem in this collective thread, see the "What would make this equation true??"-video: How do we express y to be odd?

Commenting the OddQ[] part outputs all solutions, from which one could pick the odd y solution, namely y=57:

In[1]:= FindInstance[{(*OddQ[y] == True,*) 0 <= x <= 100, 0 <= y <= 100, 1/x + 4/y == 1/12}, {x, y}, Integers, 100]
Out[1]= {{x -> 24, y -> 96}, {x -> 28, y -> 84}, {x -> 30, y -> 80}, {x -> 36, y -> 72}, {x -> 44, y -> 66}, {x -> 48, y -> 64}, {x -> 60, y -> 60}, {x -> 76, y -> 57}, {x -> 84, y -> 56}}

But when I uncomment in the above code, there is no result. Basically I am asking: How do we define in set of equations a variable to assume odd integer values only, for use in mathematical expressions or equations within Solve[], Reduce[], Simplify[], FindInstance[]etc.?

Posted 4 months ago

Hi Raspi,

Seems like FindInstance requires numerical equations, booleans do not work. This works

FindInstance[{0 <= x <= 100, 0 <= y <= 100, 1/x + 4/y == 1/12, Mod[y, 2] == 1}, 
  {x, y}, Integers, 100]
(* {{x -> 76, y -> 57}} *)

@Mike Thanks for your post and workaround code! I absolutely understand what you mean with generating the full set and then filtering the solution. I used this approach a lot in the stochastics text project which I was working on for 7.0 months (completed in mid April, some 800-1000 pages total).

Looks like our legendary Rohit has beaten us to it, I will try to remember the trick of defining an odd number through the Mod function, thank you @Rohit, works like a charm! See you guys in the next problem :-)

Posted 4 months ago


On the 2nd problem.

In my day job writing and optimizing SQL, I run into interesting situations like this all the time. The direct and logical approach just doesn't work, or doesn't work in a reasonable amount of time.

In those situations, I have found that I can sometimes get what I need by first getting more than I need and then filtering, What amazes me most is that sometimes I can get what I need sub-second using the round-about approach when the direct and logical approach can run for hours.

Using this indirect approach, I think this solves this problem:

 FindInstance[{(*OddQ[y]==True,*)0 <= x <= 100, 0 <= y <= 100, 
   1/x + 4/y == 1/12}, {x, y}, Integers, 100], 
 OddQ[#[[2]][[2]]] &

Of course, I would agree with anyone who said that this approach is cheating. But, it has helped me overcome challenges that others gave up on.


In the "An interesting integral with the floor function."-video the youtuber claims that the value of the integral is $I=1-2 \ln (2)$, which is a negative value: $$I=\int_0^1 (-1)^{\left\lfloor \frac{1}{x}\right\rfloor } \ dx=\ldots =1-2 \ln (2)\approx -0.386294$$ Imho the Wolfram L code for this expression should be:

\[CapitalIota] = Integrate[(-1)^Floor[1/x], {x, 0, 1}] (* //N  out=0.4375 *)

However, Mathematica outputs the integral uncomputed and the NIntegrate[] function returns the positive value $0.4375$. WolframAlpha outputs $0.4375$ for the value of the integral, too. Did I make a user error or is our software indeed wrong?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract