# Limited functions calculator

There's a calculator with 10 functions exp, square, sin, cos, tan and their inverses. We need to convert 0 to 1 to 2 to 3 to -3. Note: Addition, subtraction, multiplication and division are not there

• Is the calculator in degrees or radians? – Rand al'Thor Oct 11 '16 at 23:10
• Does the calculator allow complex intermediate values? – 2012rcampion Oct 12 '16 at 0:38
• This is a fascinating broken-calculator variation and makes me wonder about the smallest subset of push-button functions (perhaps standard calculator keys, perhaps not) that could produce any rational number – humn Oct 12 '16 at 4:39

(This began as combined answers of Gareth McCaughan and humn, and has progressed nicely.)

As spoilered as it gets:

0$\cos$1$\exp$ $e$ $x^2$ $e^2$ $\log$2$\exp$ $e^2$ $\surd$ $e$ $\surd$ $e^{1/2}$ $\log$ $\frac{1}{2}$ $\cos^{-1}$ $\frac{\pi}{3}$ $\tan$ $\sqrt{3}$ $x^2$3$e^x$ $e^3$ $\tan^{-1}$ $\alpha ~ \small \big( \dfrac{\sin\alpha}{\cos\alpha} = \dfrac{e^3}1 \big)$ $\sin$ $\small \dfrac{e^3}{\sqrt{1+e^6}}$ $\cos^{-1}$ $\beta ~ \small \big( \beta = \frac\pi2{-}\alpha \, , ~ \sin\beta = \dfrac1{\sqrt{1+e^6}} \big)$ $\tan$ $\small \dfrac1{e^3}$ $\log$−3

• Do we even need the description of the intermediate functions anymore, seeing as the short form doesn't use $x+1$ anymore, and only uses $-x$ in one place? – 2012rcampion Oct 12 '16 at 3:17
• Cleaned up, @2012rcampion. Thanks to your improvement, the buttons might well fit on a single line by themselves now. – humn Oct 12 '16 at 4:14
• Spoilertagging doesn't really work with that keyboard-style formatting: the only thing that's hidden is the result of each operation, which is easy to deduce anyway since we know the starting point. – Rand al'Thor Oct 12 '16 at 13:52

Here's the missing piece in humn's otherwise excellent answer: how to get from 3 to -3.

First of all, it's enough to get from exp(3) to exp(-3); in other words, we need to take a reciprocal. It's then enough to get from atan(exp(3)) to atan(exp(-3)), which means getting from $x$ to $\pi/2-x$ for some $x$. But we can do that by taking sin and then acos.

So the specific sequence of operations is:

exp atan sin acos tan log.

Here are the given functions:

$e^x$ $\rm ln$ $x^2$ $\surd$ $\rm sin$ $\rm asin$ $\rm cos$ $\rm acos$ $\rm tan$ $\rm atan$

These functions can be contructed from those:

$|x|$ $\, : ~~~ x$ $x^2$ $x^2$ $\surd$ $|x|$ $\raise-1ex\strut$

$1{+}x$ $: ~~~ x$ $\surd$ $\surd x$ $\rm atan$ $\theta$ ($\tan \theta = \surd x$) $\rm cos$ $\frac1{\sqrt{1+x}}$ $\rm ln$ $-\ln \sqrt{1+x}$
$|x|$ (as constructed) $\ln \sqrt{1+x}$ $e^x$ $\sqrt{1+x}$ $x^2$ $1+x$

This gets to 3:

0 $1{+}x$ 1 $1{+}x$ 2 $1{+}x$ 3

To convert 3 to -3, see Gareth McCaughan’s answer or the combined wiki post.

• 0 to 1:

$\exp(0)=1$.

• 1 to 2:

$\cos^2(\tan^{-1}(1))=\frac{1}{1^2+1}=\frac{1}{2}$; take the inverse to get $2$.

• 2 to 3:

$\tan^2(\cos^{-1}(2^{-1}))=\Big(\frac{1}{2^{-1}}\Big)^2-1=3$.

• 3 to -3:

$\log((\exp(3))^{-1})=-3$.

• Just to clarify: $\cos^2(x)=\left(\cos(x)\right)^2$, not $\cos(\cos(x))$, right? – 2012rcampion Oct 12 '16 at 0:06
• How do you perform 1/x? – humn Oct 12 '16 at 0:08
• @2012rcampion Yep. Squaring is allowed, according to the question, even though multiplication isn't. – Rand al'Thor Oct 12 '16 at 0:14
• @humn Taking inverses is allowed according to the question. – Rand al'Thor Oct 12 '16 at 0:14
• Inverses of the functions given – humn Oct 12 '16 at 0:15