# Maximize Your Coding Efficiency: The Importance of Notebooks

Written on

## Chapter 1: The Value of Traditional Note-Taking

In the early stages of my Ph.D. journey, I have transitioned from understanding foundational concepts to diving into the practical aspects of programming. My current focus is on using Matlab to handle equations that often involve massive matrices. To put it into perspective, these matrices can contain as many as 50,000 elements per dimension, resulting in up to 2.5 billion elements when squared.

When dealing with such extensive matrices, planning on paper becomes essential.

No matter what programming task you undertake, as your project expands, it can quickly become overwhelming to keep everything organized in your mind. To alleviate this mental burden, I have adopted a simple yet effective approach: using pen and paper. Let’s explore a practical example of how I utilize this method in my coding process.

Assuming we are working with a 504x504 diagonal matrix in Matlab, where only the diagonal contains values and all other entries are zero, we can visualize it as follows:

Imagine this matrix as a checkerboard, where each blue dot signifies the presence of a value.

Often, we need to integrate smaller matrices or sub-matrices into this larger one to create new matrices necessary for our computations.

Manipulating matrices in Matlab almost always involves loops, whether using for-loops or while-loops. Regardless of the approach, you will need to manage indices effectively. Here’s an example loop-structure for constructing a global matrix in a simulation:

for d = 1: phasenr

for a = 0 : phasenr-1

for b = 0 : Anzahl_Knoten*Anzahl_Elem-1

for z = 0 : Anzahl_Knoten*Anzahl_Elem-1

if (Wellenintervall(d) > 0)

GDI_pos(b+1+a*Anzahl_Knoten*Anzahl_Elem : a*Anzahl_Knoten*Anzahl_Elem+Anzahl_Knoten*Anzahl_Elem, z+1+a*Anzahl_Knoten*Anzahl_Elem : a*Anzahl_Knoten*Anzahl_Elem+Anzahl_Knoten*Anzahl_Elem) = Q/delta_xi * Wellenintervall(a+1) * DI_pos(b+1, z+1);else

GDI_neg(b+1+a*Anzahl_Knoten*Anzahl_Elem : a*Anzahl_Knoten*Anzahl_Elem+Anzahl_Knoten*Anzahl_Elem, z+1+a*Anzahl_Knoten*Anzahl_Elem : a*Anzahl_Knoten*Anzahl_Elem+Anzahl_Knoten*Anzahl_Elem) = Q/delta_xi * Wellenintervall(a+1) * DI_neg(b+1, z+1);end

end

end

end

end

While there are ways to optimize this code, my priority lies in producing results rather than perfecting it, and this level of coding is adequate for my needs.

Regardless of the optimization, the planning phase before writing the code remains crucial. This is where having a notebook proves invaluable. I start by sketching the matrix layout and determining how each element fits into it. I then outline which indices correspond to which dimensions (rows and columns) and assess how many loops I will need before I begin constructing them individually.

By following this process, I can create a new matrix similar to the one shown below, built from the original matrix and additional sub-matrices.

This new matrix is derived from a simulation and contains more elements than the previous one.

While a physical notebook is helpful, it’s not strictly necessary. If you've read my previous blog on digital note-taking, you know that I often prefer using a tablet. My iPad is a frequent tool for this task, and I adapt my method based on what is most convenient at the moment.

## Chapter 2: Enhancing Your Coding Skills with Video Resources

To further enrich your coding journey, consider viewing the following videos that provide valuable insights into effective learning techniques.

The first video, *Taking Notes is a WASTE OF TIME When You're Learning To Code! DO THIS INSTEAD!*, discusses alternative strategies for efficient note-taking.

The second video, *Let's Talk Python: How to Program a Computer to do Anything!*, explores the limitless possibilities of programming and how to harness them effectively.