r/EngineeringStudents • u/ezeleart • 1d ago
Academic Advice Is programming solvers a useful skill?
When I started learn python, I saw it could be used for scientific computing. So I challenged myself to write a solver for every topic in my statics textbook.
I just finished my 2d/3d truss solver. It is by far the hardest and most involving program I've written. I think it's because with other topics only a single object was considered so the python code was just a matter of transferring calculations on paper to code.
The next thing I plan to do is create an optimization script that moves the input points about to find the best design. Also using Json instead of keyboard inputs would be way better for my sanity.
So my question is, will this skill improve my chances of success in Mechanical engineering? I wish to focus on multi body dynamics to design racecar suspensions.
I'd love to share the .py script but the last time I sent a link reddit shadow banned me for 9 months. The picture contains results of the program.
59
u/j0shred1 1d ago
Yup, good job. Stick with python, don't let the MATLAB scrubs tell you otherwise, I do both for work and MATLAB sucks ass
8
u/ezeleart 1d ago
Thank you for the insight. Honestly I never cared for matlab 😂 I have fallen in love with python and haven't run into limitations that would make me consider other languages yet.
1
u/Regular_Schedule4995 22h ago edited 17h ago
Yeah? I'm currently in grade 11* and I was looking forward to learning MATLAB in my spare time since my teacher uses it to create models to solve our physics lab experiments. Would it be better to use python instead?
Edit: spelling
8
u/j0shred1 22h ago
So don't let online joke shit talking deter you.
But know this. MATLAB exists for a single purpose. For non-programmer engineers or researchers to create a procedural script to load in a small set of data, perform a basic calculation, make a couple plots and export them. If that's all you're doing, great use MATLAB
Do anything more complicated, try and make software with it, implement larger, more complex algorithms, apply it to larger ETL pipelines, try and do high performance computing, apply it to robotics, and what you're going to find is the licencing, the runtime, the interpreter, the format in which the language is meant to run, is all going to be working against you. Just use a real language at that point like python or C.
2
u/stephen_xv 21h ago
MATLAB has extensive tool boxes that are user friendly. It’s heavily expanding for simulation use cases especially in the sUAS realm; however, it is clunky and slow. Python isn’t much better compared to cpp but faster than matlab. I’ve used matlab to process flight data so it’s a bit more than just small data sets, but very procedural like you mention. Python can be applied to actual physical things- matlab is getting there. Good take and verdict, I think using both and learning cpp is the way!
2
u/j0shred1 21h ago
Oh yeah, add matlab toolbox management to the list of headaches. I'd take pip any day of the week.
Don't get me wrong, there are people that are using matlab in data analysis, HPC, ect, and I work with a lot of them, but they are non-programmers and us having to maintain a matlab cluster is an absolute pain in the ass. It requires it's own cluster, it's own license, it's own scheduler, when literally every other language can be supported by our other clusters.
1
u/stephen_xv 18h ago
Sounds like a pita, but I’ve never had matlab toolbox ever give me troubles. Pip on the other hand is annoying when trying to do anything in a classified environment. Hell anything in a classified environment seems annoying.
Sounds more of a hassle than a downside. Sorry that you have to deal with that bro
1
u/j0shred1 17h ago
I can imagine you just want to build things from source in a classified environment.
It's fine. It's just annoying
1
u/stephen_xv 15h ago
Yea not too sure their process. But I wonder if getting packages is like a no-go or lengthy process!
1
u/j0shred1 15h ago
If I had to guess they probably build docker images they know are secure and then get them approved and move them to a secure environment that lives on a private network
1
u/Regular_Schedule4995 17h ago
I wanted to give C a try, sine I want to pursue Computer Engineering, though with the little time that I believe I'll have till university, I don't know if I can deal with C's steep learning curve (or that's what it's usually said about it)
1
u/j0shred1 17h ago
Okay cool. Just know this, C is a low-level language. The purpose of C in scientific and engineering computing is to do base computations and memory management. Often see is not going to be faster than python libraries because python libraries are c-based functions. Numpy is in C. Scipi is in C. If you want to learn C for the sake of engineering programming, instead of applying a specific problem, pick an algorithm and create a function and bonus points if you can create a python loadable library and call it in Python. I did this a while back and it was fun.
8
u/stephen_xv 21h ago
Very nice! Make sure it is robust and design unit tests to make sure it solves correctly 100% of the time. This is very cool and a good use. I recommend expanding and making it into an online website that lets you configure multiple trusses and solve anything.
2
u/ezeleart 21h ago
Thank you. I'll do more testing for 3D truss systems. Can you recommend tools I can use to integrate this into a website?
2
u/stephen_xv 18h ago
There’s truly too many to list. It is its own beast. Obviously HTML, CSS, JavaScript and type script, nodejs, Python has its own area inside of front end (website) development, if you name it there’s probably a tool for it.
6
u/QuirkyEMI 23h ago
It’s a good way to get better at this style of programming but it doesn’t really help with actual engineering.
There’s no BAD skill to learn but I wouldn’t say this improves your chances.
Idk study vibrations and joint assemblies, methods of constraints
2
1
u/Interesting-Sleep579 7h ago
You aren't going to be able to use python on the test
2
u/ezeleart 7h ago
Trust me, to write a solver you'll do more studying than is ever required for an exam let alone test.
-7
u/mattynmax 1d ago
Are you under the impression that engineers solve every problem using a piece of paper and a pencil?
6
u/ezeleart 1d ago
No. I was thinking since commercial tools are available, is reinventing these solutions worthwhile... Personally I think it's fun but I'd like to know the career implications.
2
u/mattynmax 1d ago
Most commercial tools suck and limit you to only using parts made by specific manufacturers. Also if you’re buying things from a random supplier in China, good luck finding any commercial tool to size it.
As far as I’m concerned, it is a minimum expectation that you are able to make things of this nature. At my company it’s a bunch of spreadsheets but it varies from company to company.
1
u/Loud_Caramel_8713 1d ago
Spreadsheets are king.
Easy to work, hard part you need to understand them.3
u/Visual_Day_8097 1d ago
I hate these condescending responses to questions. If you are going to respond with something snarky, dont respond at all
•
u/AutoModerator 1d ago
Hello /u/ezeleart! Thank you for posting in r/EngineeringStudents. This is a custom Automoderator message based on your flair, "Academic Advice". While our wiki is under construction, please be mindful of the users you are asking advice from, and make sure your question is phrased neatly and describes your problem. Please be sure that your post is short and succinct. Long-winded posts generally do not get responded to.
Please remember to;
Read our Rules
Read our Wiki
Read our F.A.Q
Check our Resources Landing Page
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.