Algebra & Python

I’m just wondering, about how much experience would someone need to be “fluent” in Python? Would I need a heavy knowledge of algebra to create a script such as a particle fluid simulator? I’m in 8th grade learning Algebra 1 so I don’t understand this:
but I can solve basic equations like linear equations. In short, would it be logical to try and write scripts with only an 8th grade math knowledge?

I am just learning Python myself, but to my knowledge, you don’t necessarily need a heavy math background to do coding, especially Python. However, if you’re going to write a particle fluid simulator, I’m almost positive you’ll need a bit more math. Try googling something like “mathematics of fluid dynamics.” That will be a good starting point.
Hope that helps ; )

It is always worth trying. Coding is more about logic rather than math.

Its not about experience. Somebody from another language could probably switch quite easily to Python and be “fluent.” Its more about what you can create and how “pythonic” (i.e. concise) it can be. Of course that’s all subjective, since there really is no test for “fluency” in programming languages.

Would I need a heavy knowledge of algebra to create a script such as a particle fluid simulator? I’m in 8th grade learning Algebra 1 so I don’t understand this:
but I can solve basic equations like linear equations.

You’d probably need a decent knowledge of calculus to do something like a particle fluid simulator. To be frank, though, all you really need to realize is that a derivative is a fancy word for taking the slope of an arbitrary curve. To do so numerically is relatively simple. There may be some vector concepts you could miss out upon, and going it alone could be frustrating if you don’t have some educational background in it.

In short, would it be logical to try and write scripts with only an 8th grade math knowledge?

Yes its worth it. As Atom said its more about logic than math. I do add the caveat though, that when attempting to do something mathematical, its easier (if not necessary) to understand what your doing and why you’ve chosen to do it. If you just start beating it with a stick, then when something finally breaks (i.e. you find a bug in your script), its going to be much more difficult to go back and say “what am I doing logically here, why’d I do it, and how can I test the results to make sure what I get back is correct?” (That last one is especially important).

In short, go for it, but take it one step at a time. Find some motivating goal and use it as impetus to learn.

Whoa. Don’t get things mixed up. This looks like an extremely hard to solve partial differential equation and is far way from simple Algebra. You need some advanced analytical methods to tackle such a problem (in theory) and the algorithms (in practical use) you can use to solve it, do require some knowledge about the basic principles of Differential Equations.
Just to tell you the difference: in an algebraic equation (a linear equation, for example, which you will surely hear in your course) you solve for certain variables, which occur in the equation itself. LIke you have 3x + 5y + 7z = 0 and you solve for (x,y,z).
In an equation like the one above you do something different: here you solve for u, where u is a function in the variables (r, theta, z). In the equation it is possible that the partial derivatives for every single one of these variables occur (as above), but not only that, but also higher partial derivatives and even the function u itself. Although methods of Linear Algebra are needed to work with monsters like that, the field of PDEs is still not easy to grasp. But a very important field of research, since many natural phenomena are described by such equations (as you say, a fluid simulation works with these…).

All I’m trying to say: to learn CODING or Python, you definitely don’t need Algebra. You need some free time, some dedication and some logical thinking. But to make such simulators it definitely wouldn’t hurt to have some basic knowledge in the theory of what you’re trying to simulate. It really isn’t nice, as forte said, to implement some algorithm and don’t have clue about what it actually does. Keep it simple at first, just like I do :wink:
(Learning python at the moment as well.)

I agree with your last two statements, but what type of coding can you do without at least “some” knowledge of algebra and how “well” will your code be written?
I had someone tell me last year that they were interested in “computer science”…but wouldn’t need physics, and I guess algebra either. RIDICULOUS! These things aren’t “mutually exclusive”, they all integrate with each other, and if you plan on getting a degree in computer science (which is basically where you “really” learn to write code), I’d be hard pressed to find a decent college/university program that doesn’t require STRONG math skills as well as at least two of the major sciences (chemistry and physics)…and for good reason.
Also, I would argue that Algebra (or any math), and logic, are pretty closely tied together if not the same thing. In fact I’m pretty confident in saying that math/algebra IS logic. I see posts like this and I absolutely “cringe”. It’s no wonder there is so much garbage code in computers these days.

To the original poster. The function you have there is indeed calculus (Navier Stokes for incompressible fluids, in particular I think the version you have there is for fluid flow using a cylindrical coordinate system, which is generally appropriate for internal pipe flow). It’s more physics than anything else, calculus was written for physics. Even though calculus really “is” algebra (contrary to popular belief) the difficulty comes from deciding just how and what boundaries you are going to solve this equation with. The equation is very “generic”. It’s not like a specific algebraic equation, such as a linear equation, with a specific y solution for every x value input and you just write code to multiply one thing by another, add something, and it pops out a number. Calculus is more a language of “general” equations that describe how the physical relationships apply to the situation. Within that one equation you’ve linked, there are numerous different types of “specific” solutions involving equations with “many variables”.
Also, in 3D graphics, most often the simulations are a “simplification” rather than direct solution of this or other related theoretical equations. Basically they are more of an “if it looks ok, then it is ok” variety, rather than a “real physically accurate solution” that a specific solution to this full equation would lead to. The reason for this is, these types of solutions are computation intensive (time consuming for the computer to do), and therefore it takes some simplification (and optimization) to do this type of thing for real world use. Python wouldn’t probably be the best choice for a “real” (or simplified) solver, as it would be dog slow as it is, let alone with the fact that the code also needs to be interpreted.

That said, keep at it. I admire that you are working on learning code in 8th grade, as it should be honestly. I started coding in Basic (a long time ago on a TRS-80), when I was going from 7th to 8th grade on a friends computer. You’ll know far more than your present and future teachers soon enough. :smiley:

As the poster I quoted said, I’d start out simpler. Maybe make some simple GUI buttons to take input, and then maybe a function or two to output some values. Then I’d work my way to trying to manipulate something in the blender 3D window using python code (if Blender is indeed your target application for your python).

Good luck.

My Algebra teacher said that algebra is like logic itself. If you have good logic, you can be good in algebra.

I have an idea. It would approximate how particles move in particle fluid. I’m sure the equations for my idea would be much more simple than Navier Stokes equations. Myke, once you said theta, I had no clue what you were saying, LOL. Anyway, when the particles move, wouldn’t it be simple to make them avoid each other but still have an attraction force to simulate surface tension? You know what I mean?

Yeah, especially if you just want to make games in the BGE. It’s simple scripting. But you have to learn to be organized, and you have to learn how to do things best. It’s good to examine the works of others.

Blender scripting seems much harder, I haven’t gotten myself, at least yet onto it, but I might someday.

Programming languages are just languages, you’re telling the computer what to do, which can involve math, normally simple things such as addition, multiplication, etc.

Hmmm, yes, that is certainly not wrong. The same applies for any mathematical discipline although I’d also say that you need quite a lot of creativity to be good at it :wink:
And I knew that was some kind of PDE…Navier Stokes it is, then…I see why you posted that one (waves and such…). Again, I’d not advise you to start with something like a fully operational fluid simulation that right now…or you get some help from a teacher or someone else who knows about the theory and the algorithms involved. Or you do it on a very simple level, as B3D00 suggested, in the game engine or something.

Also, Theta is the greek letter in the second term of the equation in the picture :wink:

I know what theta is… I’m just saying that after you said theta, it was all downhill from there.

Is coding Python in Blender different than coding Python in the IDLE?