I recently watched this video, in which he solves the equation $$f(x)+f\left(\frac{1}{1-x}\right) = x$$

The answer is $$f(x) = \frac{x^3-x+1}{2x(x-1)}$$

I tried to solve this functional equation using the following models (optimization is done through Adam in each case):

  1. A multilayer perception with one hidden layer of 100 nodes and relu as the activation function.
  2. Two hidden layers with 100 nodes, everything else being same as 1.
  3. Defined a custom layer $$ L(x) = A + Bx + Cx^2 + Dx^3 $$ and the model is then $$ M(x) = \frac{L_1(x)}{L_2(x)} $$ where $L_1$ and $L_2$ are two different instantiations of L.

But, to my surprise, even model 3 didn't work. So, my question is how can I solve this functional equation using neural networks?

This is my colab notebook link.

  • $\begingroup$ The way you use loss is weird, I am not sure Pytorch support that format. Besides that, why you sum the output from the model with a sigmoid of x. If you are not familiar with machine learning, do the word polynomial interpolation make you feel interesting? $\endgroup$ – CuCaRot Dec 16 '20 at 9:47
  • $\begingroup$ I agree that my usage of loss is weird, but it gives me the mean squared error like I want. $\endgroup$ – user43000 Dec 16 '20 at 10:29
  • $\begingroup$ Also, if you look closely, my target is x (my input) and my prediction is model(x) + model(1/(1-x)). My prediction is the LHS in the above equation and my target is the RHS. $\endgroup$ – user43000 Dec 16 '20 at 10:31
  • $\begingroup$ I know about polynomial interpolation. But the actual solution of this equation is not a polynomial as I have mentioned, rather it is a ratio of two polynomials, which is precisely why I went ahead with model 3. $\endgroup$ – user43000 Dec 16 '20 at 10:37
  • $\begingroup$ Can you plot the loss training graph? $\endgroup$ – CuCaRot Dec 16 '20 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy