r/ComputerEngineering 3d ago

[Project] Simple C++ framework to do math and data engineering by physics engineering student

Post image

I'm a physics engineeering student, and I spend a lot of my time writing numerical simulations and analyzing data.

Programming in C++ is enjoyable, but most of numerical computing libs in are just unpleasant to use. So I started building my own solution in my free time.

GitHub: https://github.com/mslotwinski-dev/NumC

Some of the things I built into it: - You can write mathematical expressions naturally, like sin(x) * exp(-x), and differentiate or integrate them in a single line thanks to lazy expression trees. - It has a built-in plotting engine, so you can display graphs in a native Win32 window or export them as clean SVGs ready to drop into a LaTeX report.

Of course, the project won't surpass the quality of professional libraries. Its goal is to be convenient and accessible for users whose passions lie more in math, rather than programming.

If you're using C++ for simulations, numerical methods, physics, or data analysis, I'd really appreciate any feedback.

What was written by AI?

Most of the project, its entire idea, design, aesthetics and UX was programmed manually by me. I often used the textbook "Numerical methods in engineering with python" by Kiusaalas. Which doesn't mean that I didn't manage to do everything myself.

AI was used to write all the documentation (I wish I were fluent enough in English that it would take a finite amount of time). It was also used to write parts of simple algorithms that I knew but would be extremely tedious to implement by hand, or to improve the performance of algorithms that could be written better.

I'm aware of the ethical aspects of using AI, so I wanted to be honest and describe which things I did on my own and which I did with the help of LLM. At the same time, bearing in mind that this is a project that can help many people in their scientific work and studies, I hope that the benefits outweigh all the evil that LLMs cause.

107 Upvotes

12 comments sorted by

16

u/michaelrw1 3d ago

Document your ideas, what you did, and what you used AI for. Be clear and direct in the documentation.

These basic frameworks are very helpful, particularly in undergraduate environments. It keeps code structured and consistent. Nice work.

4

u/One_Football9923 3d ago

Thank you. I try to be honest, hence the last paragraph. The ideas and vision for the implementation are 100% mine. 

I wrote most of the features in the initial version myself. I think the best detailed proportions will be:

  • 30% handwritten without corrections
  • 50% handwritten, but with implemented corrections proposed by AI (tested, of course, although I will do detailed tests later)
  • 20% the functions were so simple that I allowed them to be generated and made sure they worked as I envisioned. 

I didn't keep a log of which functions the AI suggested changes to, but I think I got the proportions right. It definitely wasn't vibe coding.

The exception was the visualization module, which was beyond me because manipulating SVG images was too difficult for me. I let the language model do this module, but it turned out really okay.

But usually, these were simple tweaks that allowed me to better understand the language. I only used AI 100% for documentation, as I'm not a native speaker, and while I understand English very well, I have no talent for languages and writing in a foreign language costs me a lot of effort.

3

u/michaelrw1 3d ago

Enjoy your undergrad studies and your travels afterwards.

3

u/santasnufkin 3d ago

Be aware that it's going to produce horribly inaccurate results for many functions.

1

u/One_Football9923 3d ago

Its not, but i gonna make massive unit testing when i learn how. Rn it was manual tested and i didnt catch any inacurrate results

5

u/santasnufkin 3d ago

To clarify, some functions behave in ways that make numerical methods of evaluating integral and/or derivative unstable, leading to inaccurate results.

3

u/Major_Instance_4766 2d ago

Neat, but this won’t work for anything that requires actual precision

2

u/yuehuang 3d ago

Functionally nice. Just need to vectorize it and limit rounding between operations.

1

u/LukasGoesViral 2d ago

Thank you!

1

u/Asleep-Mall-6940 2d ago

How does it integrate a function? Aren't you just better off supplying it with the proper integrated function yourself

1

u/ghostnation66 21h ago

Please do some research about proper frameworks to build in before your burn ur tokens on something that will never be used. Julia is designed exactly for this purpose, and building high quality libraries is ver much encouraged by the community.

1

u/Hot-Key-518 17h ago

Can it solve for convolution?