This sandbox is intended for saving drafts of long, complex answers, especially answers whose composition takes a long time. It serves to localize to one thread the front-page "bumps" caused by edits to drafts of such answers, so that they may be easily ignored. Also, it helps to guard against losing longly-composed answers due to system crashes.

When you are happy with your draft here, you may simply copy the code and paste it to the desired location.

Proper Use of the Sandbox

  1. Do not post a new answer! We wish all the answers on this page to be owned by the Community user (so that only a non-sentient bot is informed of edits to these answers). Posting a new answer will make you the owner, meaning that you will be notified whenever another user makes an edit to that answer.
  2. Do not delete answers! Deleting seems like a reasonable option, but there are no "hard deletions" on Stack Exchange, and users will sufficient privileges will still see your supposedly deleted postings.
  3. Do look for an answer which indicates that it is free and then edit it to your heart's content. If none looks available, take over the one that has been left unchanged the longest (which will appear at the bottom of the page if you order answers by "activity").
  4. Do clear your draft when you are finished. This includes removing all $\LaTeX$ from your answers. Replacing all code with a simple statement like
    This answer is free for anyone to use
    is sufficient. Periodically users may go through and free up answer slots that have not been edited in, say, over one month. But you can aid in the smooth running of this sandbox by clearing away your drafts when you are finished with them.
  5. Do not create new such sandboxes. The point of having a unique such sandbox is that it minimizes the noise on the front page when the sandbox is edited. If there were multiple sandboxes they will frequently occupy numerous front page slots, pushing other topics off the front page, and increasing noise.
I have added a [sandbox] tag to allow people ignore it more easily (via software support of ignoring tags), and since it seems that we have two sandboxes now, a tag may seem a bit more in place here. –  Asaf Karagila Jul 18 '12 at 8:35
+1, great idea! It might be preferable if moderators delete "free for use" posts from time to time. You don't want two users writing their extensive, carefully crafted answers as edits of the same post and overwrite each other. Also, Chrome crashes from time to time. For some reason, I don't lose what I've written in an original post, but lose it when editing. So if I would use this thread, I would still prefer to create a new post. –  Michael Greinecker Jul 18 '12 at 11:06
@MichaelGreinecker, since deleted answers are still visible for 10k+ users, they would just accumulate in a useless state if they were deleted rather than reused. Also, if you prefer working in a pristine post rather than saving-and-then-editing (such as due to the autosave), then this sandbox is probably not for you anyway. You could do that just as easily at the eventual location of your post. –  Henning Makholm Jul 18 '12 at 11:13
(+1) For thinking outside the (sand)box. –  cardinal Jul 18 '12 at 19:40
My own practice for sandboxes is to post a stub question and then delete it immediately. If you don't leave the page, you can continue to edit the deleted question, and then undelete it when you are finished. –  MJD Jul 23 '12 at 18:14
I have discovered a drawback of the method I described in the previous comment: moderators might choose to undelete your sandbox without consulting you. If you do use this method, it is probably a good idea to attach a header that says draft in large letters. –  MJD Jul 24 '12 at 13:40
I must say I am somewhat curious to why there are up/down-votes on the sandbox answers... –  Willie Wong Jul 24 '12 at 13:44
@Mark Please don't delete any answers in this sandbox. Deleted answers are displayed to users with 10k+ rep. If every answer was deleted when done, then the thread would eventually have hundreds of deleted answers, which would make page navigation and MathJax rendering very complex for 10k+ users. That is why I advocated reuse of answers. –  anon Jul 24 '12 at 14:14
@Willie My guess would be that they are used to keep the answers sorted (so that they are not permuted randomly and user who edited one of the answers finds it in the same place when it returns). Perhaps it is slightly more comfortable that way. –  Martin Sleziak Aug 6 '12 at 8:37
I find the sandbox is too slow to edit a long answer. –  Makoto Kato Aug 26 '12 at 0:37
@Makoto MathJax can get very slow when rendering long answers. I don't think the sandbox plays any role in what you see, since there is no other TeX code on the page. –  anon Aug 26 '12 at 2:15
@MakotoKato, unfortunately, you have chosen the worst possible browser to use. IE8 is slower than all other browsers (e.g., IE9 and IE7 are twice as fast, chrome is 5 times as fast for MathJax). Switching browsers would give you an immediate performance improvement. Short of that, the incremental preview that I link to above would help you a lot as well. I will look into it more, but IE8 has such poor performance, I doubt I can do much to help. Do you shut down your browser between uses, or is it running all the time? –  Davide Cervone Aug 29 '12 at 10:33
I just did some timing tests, and here are the results. Editing Makoto's post (with over 400 equations), to retypeset the entire page: in IE8, 2 minutes 25 seconds, in IE9, 12 seconds, in Safari 5, 10 seconds, in Firefox 15, 13 seconds. So you see that IE8 is really a bad choice or this type of work. The reason it is so bad is that any time MathJax asks for the size of some piece of mathematics (so it can place the superscripts properly, etc), IE reflows the entire page, and that slows things down considerably... –  Davide Cervone Aug 29 '12 at 11:18
At the suggestion of the moderators, I have gone and changed the associated owners of all the answers here to the Community user. This way, the original owners will not receive excess pings for each time another user uses the draft space for their work. Enjoy! –  Grace Note Oct 5 '12 at 14:45
To prevent crashes I've found the "Bookmarks to disable/enable MathJax", provided in here, pretty useful. –  leo Dec 17 '12 at 18:03

16 Answers 16



We will prove that the $(n+2)$-gon is always the solution for non-intersecting $n$-triangles.


$A_n$ is a set of $n$ triangles satisfying the given conditions.

$s(X)$ is the area of $X \subset \Bbb R^2$.

$ch(A_n)$ is the convex hull of $A_n$, if interpreted as a polygon.

$h(A_n)$ denotes the hull of $A_n$, to elaborate -

Lets consider any candidate solution, $A_n$ (for now we will think of it as a polygon, not a collection of triangles), as a closed set in $\Bbb R^2$. Lets consider the boundary of $A_n$:

  1. if we are dealing with a simple polygon, then the boundary, ∂$A_n$, is equivalent to the hull, $h(A_n)$;
  2. If not, then the hull is a connected subset of the boundary, which contains the most area. If we then take the compliment ∂$A_n \setminus h(A_n)$, we can interpret it as the union of boundaries of closed sets, which are disconnected with $\Bbb R^2$. We will call said sets holes;

$v_h(A_n)$ equals the amount of vertices in $h(A_n)$.

$v_{ch}(A_n)$ equals the amount of vertices in $ch(A_n)$.


Postulate: If moving a set of vertices in $A_n$ can increase the total area and not violate the given conditions, then $A_n$ is not a solution.

Postulate 2: If we remove three adjacent vertices in a convex polygon, the remaining vertices are still in convex arrangement.

Triangulation theorem : Any simple polygon with $N$ vertices, can always be triangulated into $N - 2$ triangles. Conversely from $n$ triangles we can assemble a polygon with $n+2$ vertices. All triangles in such a triangulation have their vertices in the hull of the polygon.

Lemma 1: If $A \subsetneq B \subseteq \Bbb R^2$, then $s(A) < s(B)$.

Proof: Since $A \subsetneq B$, thus $B \setminus A \neq \varnothing$. From this it follows that $s(A) < s(B)$.

Proposition 1: $v_h(A_n) \ge n + 2$.

By definition $v_{ch}(A_n) \le v_h(A_n)$. There are four cases:

  1. $v_{ch}(A_n) = v_h(A_n)$ and $ v_h(A_n) \lt n + 2 $
  2. $v_{ch}(A_n) \lt v_h(A_n)$ and $ v_h(A_n) \lt n + 2 $
  3. $v_{ch}(A_n) = v_h(A_n)$ and $ v_h(A_n) \ge n + 2 $
  4. $v_{ch}(A_n) \lt v_h(A_n)$ and $ v_h(A_n) \ge n + 2 $

The $1$ and $2$ cases are not valid - $A_n$ cannot be a simple polygon with less than $n + 2$ vertices by the converse of the Triangulation Theorem, as we have not used all the given triangles. If $A_n$ is not a simple polygon, then we can swap it out for a simple polygon made from the convex hull of $A_n$, which by Lemma 1 would have greater area, the swap would also produce unused triangles.

Therefore only cases $3$ and $4$ remain, which both verify the proposition.

Corollary: $$n + 2 \le v(A_n)\le 3n - 2 $$

Proof: LS: from Proposition 1

RS: by virtue of the definition of the $h(A_n)$, it follows that we can place all triangle vertices on the circle, overlapping only the acute vertices to get $(3n - 2)$ vertices.

Note that having more than $(3n - 2)$ vertices on the circle is not efficient, as we have to space out the triangles. This process reduces both the base and altitude of each triangle, thus minimizing the total area.

Lemma 2 : The smallest area triangle in a convex polygon is always composed of three adjacent vertices.

Proof : Suppose we have a triangle where not all $3$ vertices are adjacent. Let $v$ be a vertex that is not adjacent to either of the other two. Let $a,b$ be the other two vertices. Then the area of the triangle is one half the length of $(a,b)$ multiplied by the height from $(a,b)$ out to $v$. But if $v$ is replaced with one of $v$'s neighbors, then one of the two neighbours must produce a lower height and hence a lower area triangle. Thus all $3$ vertices must be adjacent in a minimum area triangle. Original proof.

Proposition 2: All the vertices of holes are vertices of $h(A_n)$.

Proof: Consider $A_n$ as a polygon, all holes are also polygons. If there is a point not in $h(A_n)$, then it can moved about without changing the hull of the polygon. If we move it onto the one of the vertices of the hole - we will have reduced the amount of vertices of the hole. This process would give us another triangle to fill up the hole, thus increasing the area of $A_n$.

Thus if $A_n$ has a hole, whose vertex is not shared with $h(A_n)$, then $A_n$ is not a solution.

A special case of interest is when a hole has more than half of its vertices not in $h(A_n)$, in such a case it is possible to shrink the entire hole to nothing. This is the case for the example in the OP.

Lemma 3: $ch(A_n) = h(A_n)$

In Lemma 2 two cases remained -

  1. $v_{ch}(A_n) = v_h(A_n)$ and $ v_h(A_n) \ge n + 2 $
  2. $v_{ch}(A_n) \lt v_h(A_n)$ and $ v_h(A_n) \ge n + 2 $

If $v_{ch}(A_n) \lt v_h(A_n)$, then it is worth while to change as by Proposition 2 all holes share their vertices with $h(A_n)$, thus the triangles we gain can be used to fill up the hole. This would increase the total area of $A_n$. Therefore if $A_n$ satisfies the 2 case, $A_n$ is not a solution.

Theorem: $A_n$ is the $(n + 2)$-gon.

Proof: Suppose we fill up all the holes in $A_n$ with triangles, thus producing a simple polygon $P$. Consider the set of all triangulations of $P$. By Lemma 2 it so follows that we can always swap the triangles we used to fill up the hole, with triangles that are made from three adjacent vertices as these will be always smaller. Thus increasing the area.

When we remove a triangle made from three adjacent vertices, by Postulate 2 we remain with a convex polygon, for which Lemma 2 still holds. Therefore we can continue this process until we are left with a convex simple polygon with greater area.

Extending any vertex of a simple convex polygon to the perimeter of the unit circle, increases the area. Thus all the vertices are on the circle.

If we move a point $B$, in between two adjacent points $A$ and $C$, the area of $\Delta ABC$ will be maximum, when the altitude to $B$ is in the middle of $AC$. Therefore, any vertex on the unit circle is equally distanced from its neighbours.

Such a configuration can only be achieved by the $(n+2)$-gon with $n$-triangles.

Therefore, the $(n+2)$-gon, with all of its vertices on the unit circle, is the largest polygon that can be assembled from $n$-triangles.




In this game, the character have skill points ($\newcommand\spts{\operatorname{spts}}\spts$) and intelligence points ($\newcommand\Int{\operatorname{Int}}\Int$). Let $\spts_n$ the skillpoints at level $n$. At the end of each level the skillpoints for the next level are calculated according following the rule: $$\spts_{n+1} = \spts_n + \left\lfloor \frac{\Int}{2}\right\rfloor.$$ (the calculations are a little different at first level, but this shouldn't be an issue. I'm just mentioning it to avoid questions on the math in the spreadsheet I'm going to link later.)

My aim is maximizing this skillpoint gain over several levels, by identifying the best way to spend resources on increasing $\Int$.

$\Int$ can be increased according by purchasing tomes. They are subject to the following:

  • There are 5 tomes, the $i$th tome increases $\Int$ by $i$ points
  • Tomes are not cumulative. Each time a tome is used, only the greatest single $\Int$ increase from all tomes bought to that point applies
  • (this is another way to express the previous dotted element) If you've purchased several tomes, say tomes $i_1,\ldots, i_m$, here $1\leq m\leq 5$, then the total increase of $\Int$ from tomes would be of $\max\{i_1,\ldots, i_m\}$.
  • This means it's useless to buy tomes with $i\leq i_m$, where $i_m$ is the best tome you've bought at the moment.
  • This also means it's useless to buy more than one tome at each level.
  • The $\spts$ expression makes it also useless to buy tomes adding odd amounts of $\Int$ if the initial $\Int$ value is even and even amounts of $\Int$ if the initial $\Int$ value is odd.
  • Each tome costs $i$ times the price of the $1$st tome
  • During each level, the character gains a fixed amount of money. The running total of gained money at each level is given.
  • $\spts$ are calculated based on the Int value at the end of the previous level (you can't level up, then buy a tome with the increased budget, then increase your $\spts$)
  • Starting from level $n_a$, tomes can be bought at 80% their market price (this is still not implemented in the spreadsheet)
  • Up to level $n_a$, the character might or might not need to spend only a given fraction of his current money on a single item. Whether that means the remaining money at each level where a tome is purchased needs to be spent for different character upgrades or is usable for the next tome purchase is also a given input

The starting condition is going to be either $\Int_0 = 0$ or $\Int_0 = 1$ or $\Int_0 = 2$.
While the first two starting conditions are somewhat equal (you gain no $\spts$ until you can purchase your first tome), the third one is there to explore the possibility that, under some unfavorable purchasing conditions, voluntarily decreasing the initial $\Int$ by one nets the same or even a bigger amount of $\spts$ by virtue of the different subset of even/odd tomes involved in the problem, even with the starting advantage of $\spts$ gained from $\Int_0 = 2$.

Bobson from RPG.SE made a spreadsheet that can be used for manually solving the problem by inputing the $\i$ of each tome in the cell of the level at which it's purchased.
What I'm looking for is some mathematical procedure that automatically finds which tomes should be bought and at which levels to optimize the $\spts$ value at whatever level the progression stabilizes (i.e. at the level following the one that has the last tome purchase in all the different progressions, which could be set to the level following the one where all tomes could be bought at once to avoid unnecessary math).

(I'm waiting for Bobson's spreadsheet to be free of concept errors before posting it)


$\left({1+\sqrt5}\over2\right)^n-\left({1+\sqrt5}\over2 \right)^{n-1}\left({1+\sqrt5}\over2\right)^{n-2}= \left({1-\sqrt5}\over2\right)^n-\left({1-\sqrt5}\over2 \right)^{n-1}-\left({1-\sqrt5}\over 2\right)^{n-2}$


This answer is free for anyone to use


This answer is free for everyone to use.


This answer is free for everyone.


In progress for question 879618.

The substitution $x=\tan \phi$ converts this integral to \begin{align} \int_{0}^{\pi/2}\frac{\cos \phi\,d\phi}{\sqrt{1+\frac{1}{3}\sin^22\phi+\sqrt{1+\frac{1}{3}\sin^22\phi}}} \end{align} Note that the transformation $\phi\mapsto \pi/2-\phi$ simply replaces $\cos\phi\mapsto\sin\phi$ in the numerator. Consequently we symmeterize these two expressions and write $$\int_{0}^{\pi/4}\frac{d\phi \,(\sin\phi+ \cos \phi)}{\sqrt{1+\frac{1}{3}\sin^22\phi+\sqrt{1+\frac{1}{3}\sin^22\phi}}} $$ where we have used the symmetry to cut the bounds of integration in half. Since $\cos\phi+\sin\phi =\sqrt{2}\cos(\pi/4-\phi),$ we take $\phi\mapsto\pi/4-\phi$ to obtain

$$\sqrt{2}\int_{0}^{\pi/4}\frac{d\phi\cos\phi}{\sqrt{1+\frac{1}{3}\cos^2 2\phi+\sqrt{1+\frac{1}{3}\cos^22\phi}}} $$

I think your last integral is equivalent to what I got. –  Olivier Oloa Jul 27 at 23:53

This answer is free for everyone to use.


This answer is free for anyone to use.


This answer is free for anyone to use.


This answer is free for everyone to use.


This answer is free for anyone to use.


This answer is free for everyone to use.







You must log in to answer this question.