# Is it possible to predict $x^2$, $\log(x)$, or variable function of $x$ using RNN?

There were some posts that using RNN can predict the next point of the sine wave function with data history.

However, I wondered if it also works on all the functions of $$x$$, such as $$x^2$$, $$x^3$$, $$\log(x)$$, $$\frac{1}{(x+1)}$$ functions.

## 1 Answer

Yes, RNN can work on the functions you have mentioned. In fact, neural networks can approximate anything (Universal Approximation Theorem). This question also reminds me of Neural Turing Machine.

But, it would be a complete waste to use RNNs or NNs for such a task.

• Neural networks cannot approximate "anything". They can approximate continuous functions and provided that certain conditions are met. It may be a good idea to provide a link to some article that provides more details. – nbro Feb 13 at 16:54
• Thank you. It would not be a waste because i need the thing that this assumption is true to build my own algorithm. – passa kelly Feb 13 at 23:37
• The downvote is due to lack of specificity. One cannot use the UAT to justify everything, there are assumptions on the domain and the continuity of a function involved in even the most general case of UAT. – DuttaA Feb 14 at 13:13
• I know UAT doesn't cover it all but it is the only mathematical thing I can point out. Otherwise, I can say it is magic, because nobody can explain the unreasonable effectiveness of neural networks. It is a black-box which we frankly no nothing about. Hence, the need to run helter-skelter building bigger things or hitting any arrow that hits in the dark.. – Abhishek Verma Feb 16 at 21:05
• @AbhishekVerma it is true there is a lot of things which is unknown. But there are also a lot of things which are known. These are highly theoretical in nature so I won't comment on it but just seeing the question itself I can spot 2 functions which are not uniformly continuous. Hence, a little bit more special treatment is required than just UAT. Also I generally don't downvote posts but I am kind of tired of seeing answers which just use UAT as answer. My vote is locked so I can't really remove it now. – DuttaA Feb 21 at 13:06