Body: <p>I'm exploring how to solve differential equations using neural networks and discovered <a href="https://arxiv.org/pdf/physics/9705023.pdf?source=post_page---------------------------" rel="nofollow noreferrer">this Lagaris et. al. paper</a>. In the paper, the solution to a differential equation is written as a mathematical function in terms of a neural network (see the excerpt from the paper below)</p>
  <blockquote>
  <p>A trial solution is written as:
  <span class="math-container">$$ 
  Ψt(x) = A+ xN(x, ~p)\:\:\:\:\:\:\:\:(11)  
   $$</span>
  where <span class="math-container">$N(x, ~p)$</span> is the output of a feedforward neural network with one input unit
  for <span class="math-container">$x$</span> and weights <span class="math-container">$~p$</span>. Note that <span class="math-container">$Ψt(x)$</span> satisfies the IC by
  construction.</p>
  <p>For the initial value problem:<br />
  <span class="math-container">$$\Psi(0) = A\:\: and\:\: \frac{d}{dx}\Psi(0) = A{}'$$</span><br />
  the trial solution can be cast as: <span class="math-container">$$Ψt(x) = A+A{}'x + x^{2}N(x, ~p)$$</span></p>
  </blockquote>
  <p>So I'm trying to compute the solution to a given differential equation, say
  <span class="math-container">$$
  y{}''+3y{}'+2y=(16+20x)cos\, x+10sin\,x
  $$</span>
  And while I have a general feel of how to code single hidden layer neural networks in python (which I got from sites and articles like <a href="https://realpython.com/python-ai-neural-network/" rel="nofollow noreferrer">this one</a>), I'm unaware of how to convert Lagaris' equation into a python code that represents a neural network.</p>
  <p>I am aware that the scope of this question is quite deep, so I would appreciate any nudges in the right direction, thank you.</p>
  <p>Edit: I'm aware the problem can be solved analytically, but I'm exploring solving it using neural networks for research purposes.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-12T09:09:29.693Z
Comments.Text: start with last thing first. what is the result you are expecting ?
Comments.UserDisplayName: nish
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-12T09:23:56.460Z
Comments.Text: @nish I would expect the code to be able to plot a graph of the analytical solution of the differential equation, which in this case is a nonlinear function. I think the code would achieve that by finding specific points along the solution and plotting them, however, I'm unaware of how it would do so. Of course, the solution would begin as a mere estimate of the true solution.
Comments.UserDisplayName: mombash
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-21T14:45:28.430Z
Comments.Text: sorry for late reply. I did come across this SO thread. here a non linear function is used as a python code to create a graph. @mombash, here is the [link](https://stackoverflow.com/questions/51972637/nonlinear-regression-with-python-whats-a-simple-method-to-fit-this-data-bette)
Comments.UserDisplayName: nish
Tags: <neural-networks><python><feedforward-neural-networks>
Title: How to code mathematical functions in terms of neural networks?
UserDisplayName: mombash
ThreadText: # How to code mathematical functions in terms of neural networks?
  
  (Asked by: username_0 on 2022-12-12)
  
  I'm exploring how to solve differential equations using neural networks and discovered [this Lagaris et. al. paper](https://arxiv.org/pdf/physics/9705023.pdf?source=post_page---------------------------). In the paper, the solution to a differential equation is written as a mathematical function in terms of a neural network (see the excerpt from the paper below)
  
  > A trial solution is written as:
  > $$
  > Ψt(x) = A+ xN(x, ~p)\:\:\:\:\:\:\:\:(11)
  > $$
  > where $N(x, ~p)$ is the output of a feedforward neural network with one input unit
  > for $x$ and weights $~p$. Note that $Ψt(x)$ satisfies the IC by
  > construction.
  >
  > For the initial value problem:  
  > $$\Psi(0) = A\:\: and\:\: \frac{d}{dx}\Psi(0) = A{}'$$  
  > the trial solution can be cast as: $$Ψt(x) = A+A{}'x + x^{2}N(x, ~p)$$
  
  So I'm trying to compute the solution to a given differential equation, say
  $$
  y{}''+3y{}'+2y=(16+20x)cos\, x+10sin\,x
  $$
  And while I have a general feel of how to code single hidden layer neural networks in python (which I got from sites and articles like [this one](https://realpython.com/python-ai-neural-network/)), I'm unaware of how to convert Lagaris' equation into a python code that represents a neural network.
  
  I am aware that the scope of this question is quite deep, so I would appreciate any nudges in the right direction, thank you.
  
  Edit: I'm aware the problem can be solved analytically, but I'm exploring solving it using neural networks for research purposes.
  
  **Tags:** neural-networks, python, feedforward-neural-networks
  
  > **Comments:**
  > **username_1**: start with last thing first. what is the result you are expecting ?  
  > **username_0**: @username_1 I would expect the code to be able to plot a graph of the analytical solution of the differential equation, which in this case is a nonlinear function. I think the code would achieve that by finding specific points along the solution and plotting them, however, I'm unaware of how it would do so. Of course, the solution would begin as a mere estimate of the true solution.  
  > **username_1**: sorry for late reply. I did come across this SO thread. here a non linear function is used as a python code to create a graph. @username_0, here is the [link](https://stackoverflow.com/questions/51972637/nonlinear-regression-with-python-whats-a-simple-method-to-fit-this-data-bette)  
  
  ---
  
  ## 0 answers
  
  