Optimizing Gradient Descent with Crank-Nicholson Scheme for Stable Convergence

  • Thread starter pamparana
  • Start date
  • Tags
    Crank
In summary: Name]In summary, the conversation is about a gradient descent problem that the speaker is trying to solve on a 256x256 image grid using a step size of 0.5. However, the algorithm becomes unstable and produces artefacts, leading to failure to converge. The speaker asks for suggestions on how to solve this using the Crank-Nicholson scheme and determine the optimal step-size parameter. The respondent suggests using the CN scheme, explains its benefits and how to formulate the problem using it, and recommends trying different step sizes to find the optimal one.
  • #1
pamparana
128
0
Hi everyone,

This is more of a numerical question but I felt this would be the most appropriate forum. I apologise if it is not.

I have a gradient descent problem of the following form:

[tex]\psi_{n+1}=\psi_{n}+\alpha(\nabla\psi_{n}*D^{2}\psi)[/tex]

I am trying this on a 256x256 image grid where everything is spaced uniformly and dx and dy =1. I am using s step size of 0.5 using a normal gradient descent.

Somewhere down the line the algorithm gets very stable and I see some artefacts appearing and the whole thing falls apart and never converges.

Looking through the internet, people recommend using the Crank-Nicholson scheme to solve these kind of systems. However, I am having trouble formulating this in that scheme.

Would anyone know how I can structure this problem using the CN scheme? Also, is there a way to determine the optimal step-size parameter so as not to cause unstability at each iteration?

Thanks,

Luca
 
Physics news on Phys.org
  • #2


Hello Luca,

Thank you for posting your question here. I can understand your frustration with the artefacts appearing and the instability of your algorithm. I have some experience with gradient descent problems and I can offer some suggestions that may help you.

Firstly, regarding the Crank-Nicholson (CN) scheme, it is a widely used numerical method for solving partial differential equations (PDEs). In your case, the PDE is the gradient descent problem you have stated. The CN scheme is based on a finite difference method that uses a weighted average of the current and next time steps to calculate the solution. It is known for its stability and accuracy, which makes it a suitable choice for your problem.

To formulate your problem using the CN scheme, you need to discretize your PDE into a system of equations. This can be done by dividing your image grid into smaller cells and approximating the derivatives using finite differences. Once you have the system of equations, you can then apply the CN scheme to solve it iteratively. There are many resources available online that can guide you through this process in more detail.

Regarding the optimal step-size parameter, there is no one-size-fits-all solution. It depends on the specific problem and the properties of the PDE being solved. In general, it is recommended to start with a small step size and gradually increase it until you find a good balance between stability and convergence. You can also try different step sizes at different iterations to see which works best for your problem.

I hope this helps and good luck with your research! Let me know if you have any further questions.


 

1. What is a Crank Nicholson scheme?

A Crank Nicholson scheme is a numerical method used to solve partial differential equations, particularly in the field of computational fluid dynamics. It is a combination of the explicit and implicit methods, which makes it unconditionally stable and more accurate than either method alone.

2. How does a Crank Nicholson scheme work?

The Crank Nicholson scheme works by taking the average of the explicit and implicit solutions at each time step. This average is then used to calculate the solution at the next time step. This process is repeated until the desired solution is obtained.

3. What are the advantages of using a Crank Nicholson scheme?

Some advantages of using a Crank Nicholson scheme include its unconditional stability, which means it can handle a wide range of problems without numerical instability. It is also more accurate than other methods and can handle both diffusion and convection processes effectively.

4. What are the limitations of a Crank Nicholson scheme?

One limitation of a Crank Nicholson scheme is that it is more computationally expensive compared to other methods, as it involves more calculations at each time step. It also requires a fine mesh to accurately capture sharp gradients in the solution.

5. In what applications is a Crank Nicholson scheme commonly used?

A Crank Nicholson scheme is commonly used in computational fluid dynamics, particularly in the simulation of fluid flow and heat transfer in engineering systems. It is also used in other fields such as weather forecasting, oceanography, and chemical reaction modeling.

Similar threads

  • General Math
Replies
5
Views
842
Replies
3
Views
1K
Replies
18
Views
2K
Replies
1
Views
2K
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • Differential Equations
Replies
7
Views
3K
  • Differential Equations
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
954
Back
Top