Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grupo-Pinto-Álvarez
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Escuela de Fisica
Cursos
Herramientas Computacionales 23
Tareas
Grupo-Pinto-Álvarez
Commits
218b16f1
Commit
218b16f1
authored
1 year ago
by
Carlos Mario Alvarez Lizcano
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
970cf57e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
EULER_CODIGO_FINAL.py
+59
-0
59 additions, 0 deletions
EULER_CODIGO_FINAL.py
with
59 additions
and
0 deletions
EULER_CODIGO_FINAL.py
0 → 100644
+
59
−
0
View file @
218b16f1
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
time
import
perf_counter_ns
t_0
=
0
y_0
=
0
v_0
=
0
t_1
=
10
n
=
20
g
=
9.8
k
=
float
(
input
(
"
Ingrese el valor de k:
"
))
m
=
float
(
input
(
"
Ingrese el valor de m:
"
))
B
=
k
/
m
ti_inicial
=
perf_counter_ns
()
def
funcion
(
v
,
g
,
B
):
dydt
=
v
dvdt
=
g
-
B
*
v
return
dydt
,
dvdt
h
=
(
t_1
-
t_0
)
/
n
y
=
[
y_0
]
v
=
[
v_0
]
y_1
=
y_0
+
funcion
(
v_0
,
g
,
B
)[
0
]
*
h
v_1
=
v_0
+
funcion
(
v_0
,
g
,
B
)[
1
]
*
h
t
=
np
.
arange
(
t_0
,
t_1
+
h
,
h
)
for
i
in
range
(
1
,
(
n
+
1
)):
yi
=
y
[
i
-
1
]
+
funcion
(
v
[
i
-
1
],
g
,
B
)[
0
]
*
h
vi
=
v
[
i
-
1
]
+
funcion
(
v
[
i
-
1
],
g
,
B
)[
1
]
*
h
y
.
append
(
yi
)
v
.
append
(
vi
)
plt
.
figure
()
plt
.
subplot
(
2
,
1
,
1
)
plt
.
plot
(
t
,
y
)
plt
.
xlabel
(
'
Tiempo
'
)
plt
.
ylabel
(
'
Posición
'
)
plt
.
title
(
'
Posición vs. Tiempo
'
)
plt
.
subplot
(
2
,
1
,
2
)
plt
.
plot
(
t
,
v
)
plt
.
xlabel
(
'
Tiempo
'
)
plt
.
ylabel
(
'
Velocidad
'
)
plt
.
title
(
'
Velocidad vs. Tiempo
'
)
plt
.
tight_layout
()
plt
.
show
()
ti_final
=
perf_counter_ns
()
tiempo_ejecucion
=
ti_final
-
ti_inicial
print
(
"
Tiempo de ejecución (nanosegundos):
"
,
tiempo_ejecucion
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment