Is F # suitable for physics applications?

I hate physics, but I like software development. When I return to school after Thanksgiving, I will take another two-quarters of physics before I end the horror. I am currently reading posts about F # dimension members, but I have never used a language like F #. Would it be convenient to write applications so that I can learn something about Physics by doing something that I like?

I'm interested in command line applications (even those that I can simply execute and spit out an answer without requiring input) for things like kinematics, plane motion, Newton's laws, gravity, work, energy, momentum and momentum, particle systems, rotational kinematics and dynamics, angular momentum, static equilibrium, oscillatory motion, wave motion, sound, physical optics, electrostatics, Gauss law, electric field and potential, capacitance, resistance, DC circuits, Ampere law and inductance.

The reason I'm interested in F # is because of the unit functions that the language provides.

+4
source share
7 answers

In my biased opinion, F # is perfect for physics. It has a function called "Units" that does size analysis for you, providing errors if you are wrong. For example, if you write:

let distance : float<meters> = gravity * 3.0<seconds> 

This means that it will produce a compilation error , since gravity is <meters / second ^ 2> meters>. This prevents large programming errors associated with physics.

Check out Andrew Kennedy’s blog for more information.

+11
source

I went to enter the book "F # for Scientists" (an introduction is available free of charge), and it seems to be a good introduction to the field, since F # seems very well adapted to this kind of field.

Perhaps you should take a look at the introduction.

http://www.ffconsultancy.com/products/fsharp_for_scientists/

(And no, I have no relationship with the author ;-)

+5
source

Yes (any language) and No (find out what your future colleagues will use, for example, they can use python.). Interesting is Fortress .

+2
source

About dimensional analysis: a fun calculus trick once provided by one of my physics professors: given that it takes one hour to perfectly cook one pound turkey in a given oven, how long does it take to cook 2 pounds of turkey in the same oven?

Well, size analysis shows

(1) that the total amount of thermal energy needed to cook a turkey is proportional to the mass of the turkey, which itself is proportional to its volume, which itself is proportional to the cube of its average "radius",

those. Consumed heat energy is needed = k1 * (turkeyRadius "^ 3) ==> unit: m ^ 3 * k (where k1 unit is J / m ^ 3)

(2) That the total amount of thermal energy generated by the oven is proportional to the surface of the turkey multiplied by the amount of time that you cook it,

those. The heat generated by the oven = k2 * time * (turkeyRadius ^ 2) (where k2 is the unit J / s / m ^ 2)

Then using (1) = (2) you get time = k1 / k2 * turkeyRadius ^ (3/2)

i.e
- cooking time is proportional to the radius ^ 3/2
- given that turkeyRadius is proportional to the cubic root of the mass, we get the cooking time = k3 * sqrt (mass)

So, it will take sqrt (2) times longer to cook our 2 pounds of turkey, and the result is obtained without any calculation - just a size analysis.

+2
source

Yes, F # is a great way to build functional programming, as Chris Smith said in his answer. I am working on creating an extensive discussion about physics, engineering, and biology using F #. Of course, I could use input from a student like you. Programming without a real problem in life is one way of programming. Another way that is successful is to provide solutions that are only used by people using computers, and of course, another way to go, and another to build wealth.

F # is produced for fields of knowledge such as physics.

+2
source

Fsharp is one option. If you want to learn a skill that can also have longer term benefits, why not learn python. In addition, you will also have a little and meager at your fingertips.

+1
source

Studying any computer language will not teach you physics, and you can study physics by writing programs in any language.

Dimension analysis is a pretty handy tool for physics problems; it can push you away from "not even wrong."

I always got a certain perverted pleasure to get the answer wrong using the coefficients 10 ^ 34, because I was mistaken somewhere :-)

-1
source

Source: https://habr.com/ru/post/1277448/


All Articles