# Translate Programming code to Math

Almost all mathematical formulas functions etc can be translated to programming codes, can it be done in reverse i.e. code to math?

Is it possible to convert simple programming codes (programs that are not hardware or software specific) to mathematical formulas and functions? i.e. is it possible to translate a program which remove vowels from a string?

I think 'simple programming codes' is a vague statement so I have given the example of type of programs.

-
Why would you want to do that? –  Guess who it is. Nov 23 '11 at 4:28
Sure, program it all into diophantine equations. They are as powerful as turing machines. –  Carl Nov 23 '11 at 4:29
Almost all mathematical formulas functions etc can be translated to programming codes, I was wondering can it be done in reverse i.e. code to math? –  LifeH2O Nov 23 '11 at 4:31
I don't know what you mean by "translated to". Why don't you give an example of a mathematical formula and what you consider to be the corresponding code? –  Zev Chonoles Nov 23 '11 at 4:38
@ZevChonoles: simples example would be to add, multiply, divide, summation, factorial etc etc. They all can be implemented in a programming language. My question is that if programs can also be implemented in mathematical language. –  LifeH2O Nov 23 '11 at 11:55

I'll provide an example of, say, removing the third to last letter from a string. You could first translate each letter into a number through a process similar to Godel Coding. Say you use something like ASCII, and each letter gets turned into three digits. So, "math" would become 109097116104, because 109 is ASCII for m, 097 ASCII for a, etc.

If you set $x_3 = 109$, $x_2 = 097$, $x_1 = 116$, $x_0 = 104$, and let $x = 1000^3 x_3 + 1000^2 x_2 + 1000 x_1 + x_0$, so that $x$ denotes the string "math". If we want $y$ to denote "math" with the second letter removed, we let $y = 1000^2 y_2 + 1000 y_1 + y_0$ and add the restraints $y_2 = x_3$, $y_1 = x_2$, and $y_0 = x_0$. If we restrict $0 \le x_i < 1000$ and $0 \le y_i < 1000$ for all $i$, then applying this complicated system of equations on $x,y,x_0,x_1,x_2,x_3,y_0,y_1,y_2$ gives a system of equations that forces the string denoted by $y$ to be the string denoted by $x$, but with the second letter removed. This system of equations can be transformed easily into one huge diophantine equation.

Through a similar process, it turns out any problem solvable by a turing machine can be transformed into a huge diophantine equation. However, it is not a simple procedure.

-