avatarJOSÉ MANUEL NÁPOLES DUARTE

Summary

MathGPT Streamlit app creator shares insights and examples of using the app to solve mathematical problems with the help of Numpy.

Abstract

The creator of the MathGPT Streamlit app, an app that gives GPT models mathematical powers through Numpy, shares their journey and experience with the app. They explain how the app works and provide examples of its use, such as solving classical mechanics problems and definite integrals. The app has attracted a lot of attention, and the Streamlit team offered their help to make it open to the public. The creator also mentions the app's availability in a mobile app and shares some prompts they've been testing.

Opinions

  • The creator believes that MathGPT can solve mathematical problems with moderate complexity correctly.
  • The creator finds the use of Latex format to pass any kind of equation to a GPT3 model to be very precise.
  • The creator acknowledges that the app has some flaws that inherit from the parent GPT3 models but has plans to improve them.
  • The creator expresses their gratitude to the people who have been testing MathGPT and the Streamlit team.
  • The creator recommends using their AI service, which provides the same performance and functions as ChatGPT Plus(GPT-4) but is more cost-effective.

Best prompts for MathGPT Streamlit app

PS: I’m the creator of the app ;)

https://mathgpt.streamlit.app/

Starting the new year, I had several projects in mind. One of them was to take the OpenAI API more seriously, as ChatGPT has been a partner for me in studying papers, coding, and why not, having fun. Like many others, I did several experiments, trying to understand the limits of ChatGPT. I was curious for example of how much it had a spatial understanding, and the results were poor, which is understandable as the model was not trained with that purpose. But then, It was evident that the model had serious trouble trying to figure out the results of simple mathematical calculations. This is something well-known, and I started to think about how to come up with a solution. As I am a regular user of Streamlit, I wrote the code for an app with the idea of giving a GPT model mathematical powers through the use of Numpy. I named it MathGPT. You can access for free in this link:

Here is the demo video of the app:

The app worked well from the very beginning, so I decided to share it with the people that follow me on Twitter, as I had done in other projects. But this attracted great attention in comparison with my normal activity there:

So, the amazing team of Streamlit offered their help to scale the app, and make it open to the public, so I spend the whole weekend working closely with them to solve some issues. Now I can say that the app is working all well. The video below shows the use of the provided examples in the app:

Update (03/23/23): MathGPT with gpt-4 access is available in a mobile app! Try it in this link.

So here are some prompts I’ve been testing, that I think are interesting and want to share with you:

  1. Classical Mechanics. Book: Physics for Scientists and Engineers with Modern Physics, by Serway & Jewett, 9th Ed. Example 4.8, p 97. Prompt: “A boat crossing a wide river moves with a speed of 10.0 km/h relative to the water. The water in the river has a uniform speed of 5.00 km/h due east relative to the Earth. If the boat heads due north, determine the velocity of the boat relative to an observer standing on either bank.”

R: 11.2 km/h.

This is an interesting example because we can see that there is moderate complexity in the redaction, and nonetheless, the model finds the solution correctly. By the way, this is example 4.8 A), and for 4.9 B) it is necessary to ask in the prompt to give the answer in degrees, not in radians 😉.

2. Definite Integral. Example provided in a tweet by Arnaud. Prompt: “Compute the integral of the following latex defined function f: f(x)=\frac{2}{1+x} over interval 0 to 1. ”

R: 2ln(2) = 1.386.

I like a lot this example because the model understand the Latex format, and in fact I believe is a very precise way to pass any kind of equation to a GPT3 model. In the first versions, the model tried to use libraries like Sympy, and it has access to them, but currently is restricted to working with Numpy. In the following versions, we will plan to let it work with other libraries than Numpy.

3. Special Theory of Relativity. Prompt: “What is the momentum of a proton moving at a speed of v=0.86c? Use the formula: \vec(p) = \frac{m\vec(v)}{\sqrt{1-\frac{v²}{c²}}} ” R:8.44e-19 kg-m/s.

I have to say it, I wanted to have some Einstein formulas here 😅. This is a similar problem to the first one and is also a well-known Physics book. In this case, sometimes the model writes the result in units of c, which is something commonly used in physics!

4. Rotation of vectors. Promp: “Given the 2D vector (3,4), find the Cartesian coordinates of the vector rotated by 10 degrees.”

R: (2.2,4.46)

This is a simple example to show how MathGPT handles matrices and vectors. To find a vector that has been rotated, we have to apply the rotation matrix:

When dealing with angles, it may be convenient to ask the model to make the conversion from degrees to radians or the converse, depending on the problem.

Conclusion.

So in general, it is possible to find correct solutions to problems of relative complexity with MathGPT. Sometimes it has flaws that inherit from the parent GPT3 models. We have plans to improve that kind of issue. This is only the beginning. Stay tuned!

Acknowledgments:

To all the people that have been testing MathGPT in the last days. To the amazing Streamlit team. Special shout out to Johannes Rieke, Tyler Richards, and Charly Wargnier.

Help me to continue creating content like this by using the following link to become a Medium Member. For only $5/mo, you will get full access to every story on Medium and also that will support me with $2.27, thanks!

https://medium.com/@jnapoles/membership

Streamlit
ChatGPT
Gpt 3
OpenAI
Python
Recommended from ReadMedium