added update_position method #8

Open
eceku wants to merge 1 commit from eceku/2025-plovdiv-scientific-patterns:scientific into main
Showing only changes of commit 1fc40ea003 - Show all commits

View file

@ -17,7 +17,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2018-07-27T15:05:51.531289Z",
@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 7,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -59,13 +59,16 @@
" def momentum(self):\n",
" return self.mass * self.velocity\n",
"\n",
" def update_position(self, position, dt):\n",
" return position + self.velocity * dt\n",
"\n",
"particle = Particle(mass=2.1, velocity=0.8)\n",
"print(particle.momentum())"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [
{
@ -84,10 +87,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"8.28"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"particle.update_position(position = position, dt = 0.1)"
]
},
{
"cell_type": "code",
@ -118,7 +134,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.13.6"
},
"toc": {
"nav_menu": {
@ -142,5 +158,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}