Monday, April 24, 2023

For inquiring students. - II (and what is ph.D education about)

"My name is John, and I am an M.Sc. student of water engineering at the Beautiful University of Technology. My M.Sc. thesis subject is a groundbreaking one - 'Application of WRF Regional Model for Rainfall Prediction (Case Study: Northwest of Antarctica).' Under the guidance of Prof. Best Hydrologist, I have delved into the impact of predicted precipitation by the WRF model on flood forecasting in the Hec-Hms (or SWAT) model. My expertise and keen interest in climate change impacts on hydroclimatic extremes, numerical weather prediction, hydrology and water resource management, hydraulic and flood forecasting make me a force to be reckoned with in the field. "

I already wrote on the topic of students inquiring about the possibility to do a Ph.D with me. You can find previous notes here. However, I would still add something.

It's heartening to see that many schools are taking the direction of training students to run WRF, Hec-HMS, SWAT, R, Python and other tools. However, mastering tools is just one aspect of research. To truly investigate nature, one must understand where problems are and be able to modify paradigms and tools to solve them appropriately. 

As Richard Feynman said, 'The problem is not people being uneducated. The problem is that people are educated just enough to believe what they have been taught, and not educated enough to question anything from what they have been taught.' 

Becoming a solid Ph.D applicant requires making this switch and adding a few phrases to your  CV that show that you have understood the Feynman's point.  Besides, you should be inquisitive and show some fire inside for discovering new things and achieve results beyond the state-of-art (and for what regards working with me, love computer programming). A PhD is not just a status symbol or a way to gain a good salary - it's a calling for those who are truly passionate about pushing the boundaries of knowledge (see this nice infographics from an old post)

P.S. -  I also wrote this "Essential for Hydrologists" that could further help. 

Tuesday, April 18, 2023

Using ChapGPT 4 for Learning Java

 Currently, there's a lot of hype surrounding ChatGPT v4. I was curious to explore its capabilities, so I used OpenAccessGPT to bypass current Italian law and access the BOT.

I tested ChatGPT v4 by asking it to search for literature on a specific topic - the stomata action under the effect of decreasing tension in xylem. While the results were interesting, they weren't necessarily the best. In fact, when I tested the BOT on more specialized topics, its performance seemed immature.

To improve my experience, I decided to seek help in programming and discovered that ChatGPT v4 could be a valuable resource. I soon realized that my idea wasn't entirely original, as there are many resources available online, such as this YouTube video. Perhaps ChatGPT v4 could have even provided me with this information.

This is what ChapGPT tells on the topic:

"ChatGPT can be a valuable resource for learning Java in several ways:

  1. Asking Questions: You can ask ChatGPT any question you have about Java, such as how to use a specific feature or how to solve a particular problem. ChatGPT can provide you with a detailed explanation or point you in the right direction to find the information you need.
  2. Practice Exercises: ChatGPT can provide you with practice exercises to help you improve your Java skills. These exercises can range from simple coding challenges to more complex projects.
  3. Code Examples: ChatGPT can provide you with Java code examples that illustrate how to use various features and solve different problems. These examples can help you understand Java concepts more easily.
  4. Tutorials and Resources: ChatGPT can recommend Java tutorials and resources that can help you learn more about the language. These resources can include online courses, books, and websites.

Overall, ChatGPT can be a valuable tool for anyone looking to learn Java. It can provide you with personalized assistance, practice exercises, and resources to help you improve your skills and become a proficient Java programmer. "

Browsing the YouTube class, I realized that the approach to Java was good but not the way I desired. So I asked: "Please help me in learning Java but not following the traditional way. I would like that you introduce me early on Java design patterns and topics related to numerical computation. I need also you to introduce me to the use of generics. I would say introduce me to modern Java".  Here below the result

Sure, I can design a ten-hour class on the topics of Java design patterns, numerical computation, and generics. Here's a rough outline:

Day 1 (2 hours):
1. Introduction to Java design patterns
2. Singleton pattern
3. Factory pattern
4. Observer pattern
5. Hands-on exercise

Day 2 (2 hours):
1. Introduction to numerical computation in Java
2. Overview of Apache Commons Math and JScience libraries
3. Basic mathematical operations (addition, subtraction, multiplication, division)
4. Hands-on exercise

Day 3 (2 hours):
1. Statistical analysis using Apache Commons Math
2. Descriptive statistics (mean, median, mode, variance, standard deviation)
3. Hypothesis testing (t-tests, ANOVA)
4. Hands-on exercise

Day 4 (2 hours):
1. Linear algebra using JScience
2. Matrices and vectors
3. Matrix operations (addition, subtraction, multiplication)
4. Eigenvalues and eigenvectors
5. Hands-on exercise

Day 5 (2 hours):
1. Introduction to generics in Java
2. Defining and using generic classes
3. Defining and using generic interfaces
4. Defining and using generic methods
5. Hands-on exercise

Each day will consist of a mixture of lecture-style teaching and hands-on exercises, to ensure that students have a chance to practice what they've learned. The hands-on exercises will involve writing code and solving problems related to the topics covered in class.

By the end of the ten-hour class, students should have a good understanding of Java design patterns, numerical computation, and generics, and be able to apply these concepts to real-world programming problems.

Not sure that I am really satisfied but my further experiments with more detailed questions went better. Therefore, up to a point, the user has also to lear how to interact with the BOT.  When you go on more detailed questions the performance are less generic. For instance, I asked:

Can do you do examples on how define and using generics classes in Java ?

The answer was:

public class Box<T> {
    private T contents;

    public void setContents(T contents) {
        this.contents = contents;

    public T getContents() {
        return contents;

This answer is correct by a little obscure to a newbie. So I refined my request: "How can I use the previous class in a main() ?  And I have got:

public class Main {
    public static void main(String[] args) {
        // Create a Box that holds strings
        Box<String> stringBox = new Box<>();

        // Set the contents of the box to a string
        stringBox.setContents("Hello, world!");

        // Get the contents of the box and print it to the console
        String contents = stringBox.getContents();

with the comment:

"In this example, we create a Box that holds strings using the syntax Box<String>. We then set the contents of the box to the string "Hello, world!" using the setContents method, and retrieve the contents using the getContents method. Finally, we print the contents to the console using System.out.println".

Overall (there were also some other example, this was quite satisfying.  Next step: making ChapGPT learn about our own staff and being able to support, for instance, people in using GEOframe.