Search Blogs

Thursday, January 26, 2023

Linear Differential Equation With Constant Prefactors

I decided I wanted to revisit some techniques for solving ordinary differential equations. It's always good to through in some refreshers as I continue to write more for my blog. Here I'll focus on  homogenous differential equations that have the following form:

$$ A_1 \frac{d^2 y}{dx^2} + A_2\frac{dy}{dx} - A_3y =0 .$$

The coefficients $A_1$, $A_2$, and $A_3$ are all constant. This equation can be solved using the auxiliary equation, which is derived from the fact that such differential equations have a solution of the form $y=e^{mx}$. The auxiliary equation is:

$$ f(m) = A_0 m^{n} + A_{1} m^{n-1} + \dots+ A_{n-1}m + A_{n} = 0$$

The goal is to find the roots of the auxiliary equation, and if they are real, we can use the general solution to our homogenous differential equation which is:

$$ y(x) = C_{1}e^{m_1 x}+C_{2}e^{m_2 x} + \dots + C_n e^{m_n x} $$

Let us now solve our initial differential equation at the beginning of this post, where $A_1=10$, $A_2=1$, and $A_3=-2$. We start by rewriting the equation in terms of operator power, i.e., the degree of differentiation, this would be:

$$y(10L^2+L-2)=0,$$

$L$ is the differential operator. Now we want to plug the coefficients and operator powers into the auxiliary equation above:

$$10m^{2}+m-2$$

We can find the roots for this polynomial, which are $m=-\frac{1}{2}$ and $m=\frac{2}{5}$. Substitution of these roots into our general solution as given above yields:

$$y(x)=C_1e^{\frac{-1}{2}x}+C_2e^{\frac{2}{5}x}$$

the undetermined coefficients to our general condition, and therefore the particular solution, can be found from initial or boundary conditions to our differential equation. It is also worth mentioning that it is common to have complex roots and therefore solutions. 



Reuse and Attribution

Thursday, January 12, 2023

Relearning a probability density function

I'm working with some data with a peculiar histogram and since I'm interested in developing a probabilistic model for the data, I've become more familiar with probability density functions. At first, I thought the data just was a truncated normal distribution, but it had a plateau near low values of $x$. I was kind of interested in knowing what kind of probability density functions would give such a shape, and came across the Subbotin form pdf, which I then found is called the generalized normal distribution and is given by:

\begin{equation} \label{eq:gennorm}f(x)=\frac{\beta}{2\alpha\,\Gamma(1/\beta)}\exp\left(-|(x-\mu)/\alpha|^\beta\right) \end{equation}.

In the graph below, I'm changing the $\alpha$ parameter. As the value increases the width of the pdf increases, as one might expect. 

Example of a generalized normal distribution with $\alpha$ parameter changing.

So how do you get a more plateau-like distribution? It looks like it's the $\beta$ parameter that makes this possible. So changing this in in discrete steps of integers you see the pdf take the form as below
Changing $\beta$ to create a plateau.

I probably already knew about this, just feel I need to write it down somewhere and as I've mentioned in an earlier post this year, I'm just trying to write more on my blog. Mainly for myself that is, but would be pleased if others enjoy it. 




 


Reuse and Attribution

Monday, January 9, 2023

Downside to expertise/specialization

 I've noticed a lot of chatter on LinkedIn and elsewhere regarding a recent Nature paper that indicates we are becoming less impactful in terms of research.  In the paper, the authors provide a new metric that aims to capture how disruptive papers and patents are toward their respective fields. The metric seems to be based on whether a paper or patent changes the direction of research based on whether that work renders all previous related works absolute (i.e. no one refers to those older works anymore). The authors give examples of the proposed structure for DNA and how it made all previous works irrelevant and changed the course of research in molecular biology, genetics, and medicine.  This would be considered a disruptive change. Whereas they give the other scenario of the work of Kohn-Sham and density functional theory builds upon existing knowledge and is impactful but not disruptive, as the authors seem to indicate.  Using their metric, they show in figure 2, below, that the overall disruptive nature of research and technology has declined considerably in all the top-level domain groups.


Figure 2 from Park, M., Leahey, E. & Funk, R.J. Papers and patents are becoming less disruptive over time. Nature 613, 138–144 (2023). https://doi.org/10.1038/s41586-022-05543-x
Figure 2 from Park, M., Leahey, E. & Funk, R.J. Papers and patents are becoming less disruptive over time. Nature 613, 138–144 (2023). https://doi.org/10.1038/s41586-022-05543-x

From my perspective, I'm not that surprised. I mean, I've always agreed with the age-old montage that there is very little ripe "low-hanging fruit" for picking. There are for sure problems that are ripe to solve, see the example here, but these are not "low-hanging" by any means. The authors refer to this sentiment as a potential cause as well as the exhaustive amount of research being produced that makes it difficult to keep up with, but based on their defined metric and their analysis they suggest these are not necessarily the reason for the decline. I was surprised, as my bias would suspect this is the cause, but the authors argue I am wrong. My thinking is that given we have such strong physical theories that describe much of our everyday lives, most of humankind's future advances will be in deploying and finding solutions via this understanding to address our everyday needs. 

So what is the cause of the degradation in the impact our research activities are having? In the discussion part of the article, the authors indicate that their analysis points towards specialization and the narrow focus of researchers being the most likely the culprit. Hmm, I can resonate with this. I've always felt this was an issue for me, especially during and after graduate school. I've always been the kind of person who likes to learn and tinker around with any topic that piques my interest, regardless of how knowledgeable I am about that topic/field. However, I've quickly found that as a society we don't want that anymore, or at least that's how I feel. We want "experts" and "specialists", whatever those are. 

If we think about it, what made the early 20th century so productive, as shown in figure 5 of the nature paper. My opinion on this is that most academics and industry lab researchers worked on so many different topics across physics, chemistry, biology, and engineering. Let's start with arguably the most famous physicist of the early 20th century, Albert Einstein. Early on he worked on improving fundamentally our understanding of kinetic theory. Then he went on to basically seed all of the quantum theory with his theory of light-matter interactions. Finally, he wanted to better describe our understanding of time and space so he codified special relatively and then gave us a more general version of it that included gravity, i.e., general relativity. I assume he is not the exception during this era but the norm as many physicists seemed to have worked on anything that needed answering and was of interest to them. I believe Enrico Fermi was like this, and so was Freeman Dyson.


Figure 5 from Park, M., Leahey, E. & Funk, R.J. Papers and patents are becoming less disruptive over time. Nature 613, 138–144 (2023). https://doi.org/10.1038/s41586-022-05543-x

So who is doing this now, maybe a handful of physicists? I don't know, but I do know that specialization is the norm and is expected.   In my mind, it seems, clear what we need to do: encourage broad interest and application of skills and knowledge towards any area where a new paradigm, improved understanding, or novel technology would be disruptive. The authors put it in the following form:
 "Even though philosophers of science may be correct that the growth of knowledge is an endogenous process—wherein accumulated understanding promotes future discovery and invention—engagement with a broad range of extant knowledge is necessary for that process to play out, a requirement that appears more difficult with time. Relying on narrower slices of knowledge benefits individual careers[53], but not scientific progress more generally."

So next time someone asks me what my domain or technical expertise is, I'm going to say "I think, create, and solve"


Reuse and Attribution

Thursday, January 5, 2023

Back to school: Dirac's student

 I decided to change the name of the blog from "Equation a day keeps from going astray" to "Dirac's student". So why did I do this? Well, I felt the old name was tied to what I originally set out to do which was to create blogs of mathematical refreshers, and that slowly became less and less of my interest. In the past 2 years, of which I wrote only a few blogs, I've mostly focused on science topics or my opinions that are of interest to me.  This has led me down the path of becoming more of a student and trying to learn new topics and express my understanding of ideas. The thing to note is that I'm doing most of this on my personal time outside work and by myself. Thus, I thought the name "Dirac's Student" made more sense, since the great physicist Paul Dirac was considered by many to be a brilliant loner. I particularly marvel at Dirac's capabilities and contributions to quantum theory that explained the nature of electrons/fermions. So sans "brilliant", I will set out to be like Prof. Dirac, wish me luck.

P.S. I was going to go with the name "Feynman's Student" since he is another great physicist that I admire, but ultimately thought it would be easier to be like Dirac than Feynman given how amazing Feynman was at explaining difficult concepts and how to think about science. Dirac was not known for being a good communicator or teacher.


 


Reuse and Attribution

Monday, January 2, 2023

Thank you Prof. KohnGPT, can you ...

As I go into the new year I've decided that I'm going to try to make more of an effort to write more blogs on my thinking. I'm also not going to try and spend a great deal polishing and formatting, rather will publish them and then update them as needed. The point is not so much for the prospective readers but for me to archive and flush out my ideas on several topics that I have been thinking about for the last year. For one I really want to understand more in-depth the design and concepts behind ChatGPT, and more specifically how transformers are used and work. I want to think about how these natural language processing models can be used to improve working scientist writing and computing tasks. More specifically, how could one retrain/teach ChatGPT (assuming it's eventually open-sourced!) to provide materials scientists with template computing workflows. Say I wanted to perform a ground-state DFT calculation using VASP for some magnetic sulfide. I know from experience how to setup the INCAR, POTCAR, KPOINT, and POSCAR files, but how cool would it be to just type into the ChatGPT box:

Create the VASP input files to calculate the ground-state of FeS. Use the known stable form of FeS for the POSCAR file and use the a functional and pseudopotentials that have been used by previous studies.

On top of that imagine that you could then ask,

Well, I actually don't have access to VASP at the moment, can you show me the equivalent input scripts for Abinit or QuantumEspresso?

if this modified ChatGPT is delivered on this, 🀯. Think about a domain large language model for quantum chemistry and DFT, say KohnGPT. I mean imagine all the time saved on redundant tasks by computational scientists and being able to go from one code to another, unbelievable. Granted it is important to know what the keywords and setup correspond to in terms of the physics being simulated, so this isn't a replacement for learning those. But wow would this be cool if you ask me. 

Just so you know I tried this out on ChatGPT, and it failed pretty badly. It gets a good amount write, but it fails or just makes things up (I guess this is called hallucination in NLP). You can query ChatGPT to write some setups if your looking for suggestions, but truthfully any experience DFT practitioner would know these pretty quickly. Here are the outputs* from ChatGPT using the quotes above:





which gives a cubic structure, which is wrong based on the materials project entry for FeS and what ChatGPT says when I asked it "what is the spacegroup number for this structure", for which it says Pnma, #62. When I ask for the INCAR, I get:




It is incomplete and erroneous. The KPOINT and POTCAR request is given as:




The KPOINT file doesn't look bad, but as expected the POTCAR file is pointless. The latter makes sense since the pseudopotential files for VASP are only available for license holders. If I try and ask it to show the corresponding files for Quantum Espresso, it actually doesn't look too bad, but I'm not a heavy user of QE so I would need to verify.




Finally, I'm changing the blog name from "An equation a day keeps from going astray" and may migrate to a platform where I can write the post in Markdown markup.



* I had to ask ChatGPT to explicitly create the input files, it just gave me the steps initially

Reuse and Attribution