All Questions
18
questions
4
votes
2
answers
117
views
Simulate transmission spectrum of extreme ultraviolet laser pulse through laser-dressed finite sample (Python Version)
I am currently participating in research on transient absorption spectroscopy and four wave mixing. In the experimental design, an extreme ultraviolet (XUV) laser pulse and infrared (IR) laser pulse ...
8
votes
4
answers
2k
views
Simulation of a falling ball
I made a simple simulation of a falling ball. Is it possible to somehow improve or optimize this code? What tips can you give for development?
...
6
votes
2
answers
339
views
Simulating the orbits of the Earth, Moon and Sun together in Fortran
This has been racking my brain for hours now. I will try to explain as much as I can. I'm aware this code is horrendously ungraceful, but I'm new to Fortran and making things more efficient is not ...
33
votes
9
answers
8k
views
Simple n-body class in C++
As part of my training, I implemented a n-body class in C++ to simulate gravitational interaction of bodies and to get more familiar with features that C++ offers such as object oriented programming.
...
5
votes
0
answers
85
views
Butter side up?
I've written a piece of code that determines if a piece toast with butter lands on the butter-side or not, depending on its initial velocity and the table height.
The code is written in Mathematica ...
5
votes
2
answers
864
views
Simulation of spring-loaded inverted pendulum
I've finally committed to moving to Python 3 from MATLAB. I'm currently porting my MATLAB code, and I'm sure I'm missing a lot of common best-practices.
For reference, I'm simulating a spring-loaded ...
1
vote
1
answer
316
views
Vector addition and Pythagorean Theorem code
I would like to share my code that is meant to help me add 2 vectors together. It is very simple and I would like to kindly ask you whether you could review my code. Also, I decided to keep separate ...
2
votes
4
answers
846
views
Calculating energy from mass and light speed
I'm learning Java JDK 1.8 since one day and I'm using Java's methods to the first time. I have never used Java before because I'm a Python/Django developer.
I created a method which let to get energy ...
9
votes
2
answers
6k
views
Kinematic Equations
I'm learning the kinematic equations in Concepts of Engineering and so here are the equations I am learning:
To complete the lesson, I was told to create a Python program that outputs the horizontal ...
5
votes
1
answer
198
views
Calculating a table of deBroglie wavelengths for various electron energies
Here is the formula for the deBroglie wavelength of an electron versus its kinetic energy:
$$ \lambda(E_k) = h\left/\sqrt{\frac{(E_k+m_eC^2)^2-m_e^2C^4}{C^2}}\right.$$
and here is simple script that ...
2
votes
2
answers
5k
views
Simulation of 2D elastic balls
Following this SO post and this Wikipedia article, I wrote a Python script to simulate physics of 2D elastic balls.
I define the physical behaviour of each ball in the ...
2
votes
1
answer
812
views
Velocity verlet implementation
My code is meant to update the positions and velocities of planets. There are a few methods in this class, but updatePosition and ...
10
votes
2
answers
5k
views
Solar System model
I have a model that works, as far as I know, but it's so messy! I am very new to Java, so I'd really appreciate some help tidying up. In particular, a lot of my constructors are empty which is ...
3
votes
2
answers
1k
views
Program based on a physics concept
I am a beginner and I wanted to make programs that would help me while I learnt Java. I made a program to help me in my assignments. Any suggetions?
Main method
...
6
votes
1
answer
2k
views
Kinematic Equations Calculator
The program allows user to enter values for 3 of the following
initial velocity
final velocity
acceleration
displacement
time
and to specify an unknown (one of the previously mentioned variables)....