# A Can Newton's method work with an approximated integral

1. Dec 28, 2017

### fahraynk

I have a system of equations, and one of them is this : $\int(1-U(y))Dy - H*\int(U(y)-U(y)^2)dy=0$
Can newtons method work if I approximate this integral to be $\sum_y(1-U(y))-H\sum(U(y)-U(y)^2)=0$

y is a set integers in range $[1,1000]$

I have newtons method working for this same system without this equation, but I am trying to solve for a new variable (a), so I added this equation and changed (a) from a constant to a new variable, but newtons method no longer converges.
Could this be because I am using rectangle left rule to approximate the integral, and maybe rectangle left has too much error for newtons method to work?
The other thing I can try is to take the derivative of both sides giving this equation $1-U(y)-H(U(y)-U(y)^2=0$
The only problem with this is I would have to add this equation to every point on a grid, meaning it would be 1000 new equations for 1000 grid points instead of 1 equation. I would have to rewrite the whole algorithm, so I would rather use rectangle left rule if possible because it is much less coding.

Anyway, yeah, will newtons method work with rectangle left rule like this?

2. Dec 28, 2017

### Staff: Mentor

What exactly do you want to determine? The first equation is a function of H (and U) only. You want to find H? It is a linear equation, you don’t need Newton (technically it works, and gives the exact answer in one step).

What are the integration limits of your integrals?

What does U(y)2 mean?

3. Dec 28, 2017

### WWGD

What are $H$ and * ?

4. Dec 29, 2017

### fahraynk

Firstly, thank you for your reply. I tried to not input the nuts and bolts of the problem because I doubt anyone has time to get into it, so I figured I would just ask if rectangle left rule would mess up newtons method.

Anyway, If you want the run down of my problem, I am solving this equation $f'''+\frac{1+a}{2}ff''+a(1-f'^2)=0$
I break the equation into 3 equations like so :
$$f_p-f'=0\\\\ f_{pp}-f''=0\\\\ f_{pp}'+\frac{1+a}{2}ff_p+a(1-f_p^2)=0$$

Then, I have a line in the y direction that I break into a grid of 1000 points on the line. I solve the 3 equations at every point on the line, and I have 3 boundary conditions. I also change the three equations to their taylor expansions. The total system is 3000 equations, 3003 unknowns, 3 boundary conditions.

The variable 'a' is something that in the past I set manually. I set G(x) to be the sum all of the 3000 equations and 3 boundary conditions into one equation since each equals zero (superposition principal).
X is a vector of all the 3003 variables
and if I plug the above system into a newtons iteration (x=x-Jacobean^-1 * G(x)) it solves for X vector such that G(x) = 0 after about 8 iterations.

Where I am having trouble :
rather than defining the variable 'a' randomly, I am supposed to add it to the vector of variables X. I am also given a new equation that in theory is supposed to help me solve the system with 'a' as a variable :
The new equation :
$$\frac{\int 1-f_p(y) dy}{\int f_p(y)-f_p(y)^2dy}=H$$ H is a known constant. F, Fp, Fpp are functions of y.

I rearrange that equation, setting it equal to 0.
Now I think I have three options :
one : Approximate the integrals using rectangle left rule or rectangle middle rule.
Two : take the derivative of both sides to get : $1-f_p - H(f_p-f_p^2)=0$
Three : integrate the integrals (I'm not sure how to do this)

I tried the rectangle left rule, adding 1 equation to G(x), adding the variable 'a' to G(x), and updating the Jacobean matrix with the new variable, the problem did not converge. I assumed it was error so I asked here.
Tonight, I tried the second option (taking the derivative of both sides). This gave me a new equation, which I applied to EVERY point on the grid (1000 points = 1000 equations). Then I updated the jacobean, adding 1000 new equations to the jacobean.
This also did not converge, but hovered around 0.
I am not sure if the second method makes sense because I now have 4003 equations summed in G(x) with 3004 unknowns. It may have not converged due to minor errors in the code though.

5. Dec 29, 2017

### fahraynk

H is a constant, * is just multiply operation (2*3=6)

6. Dec 29, 2017

### Staff: Mentor

This “new equation” is missing limits to be well-defined (see my previous post).
Who gave you that equation?

You cannot determine boundary conditions just from your differential equation. You need some other input. What do you know in terms of initial conditions? Where do you want to find f?

Did you try to plug in a suitable exponential function? Plus some additional constant probably.

I don’t understand why you want to solve equations for 1000 y-values.

7. Dec 29, 2017

### fahraynk

I am solving for air flow above a flat plate at different heights.
The limits of that integral are 0 to y_max
I never tried an exponent because the function is non linear, and I am trying to learn to use newtons method here anyway.
Boundary conditions are from physical intuition. Fp(0)=0, fpp(y=0)=0 at plate, Fp(y_max)=1
All the equations come from a pdf I found on the internet : https://learning-modules.mit.edu/se...d70a/link?errorRedirect=/materials/index.html