Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
6d2f51b7
Commit
6d2f51b7
authored
Apr 08, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ModSim ass3: Added harmonic oscillator assignment.
parent
eb5a865f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
modsim/ass3/.gitignore
modsim/ass3/.gitignore
+1
-0
modsim/ass3/harm_osc.c
modsim/ass3/harm_osc.c
+6
-2
No files found.
modsim/ass3/.gitignore
View file @
6d2f51b7
test
test
harm_osc
modsim/ass3/harm_osc.c
View file @
6d2f51b7
...
@@ -16,11 +16,13 @@
...
@@ -16,11 +16,13 @@
INTEGRATE(RungeKutta2, t0, t1); \
INTEGRATE(RungeKutta2, t0, t1); \
INTEGRATE(RungeKutta4, t0, t1); \
INTEGRATE(RungeKutta4, t0, t1); \
}
}
/*
extern
log_function
log_func
;
void
log
(
double
t
,
double
*
y
)
{
void
log
(
double
t
,
double
*
y
)
{
printf
(
"%f,%f,%f
\n
"
,
t
,
y
[
0
],
y
[
1
]);
printf
(
"%f,%f,%f
\n
"
,
t
,
y
[
0
],
y
[
1
]);
}
}
*/
int
f_osc
(
double
t
,
double
*
y
,
double
*
dy
,
void
*
params
)
{
int
f_osc
(
double
t
,
double
*
y
,
double
*
dy
,
void
*
params
)
{
dy
[
0
]
=
y
[
1
];
dy
[
0
]
=
y
[
1
];
dy
[
1
]
=
-*
(
double
*
)(
params
)
*
y
[
0
];
dy
[
1
]
=
-*
(
double
*
)(
params
)
*
y
[
0
];
...
@@ -31,6 +33,8 @@ int f_osc(double t, double *y, double *dy, void *params) {
...
@@ -31,6 +33,8 @@ int f_osc(double t, double *y, double *dy, void *params) {
int
main
(
void
)
{
int
main
(
void
)
{
double
k
=
.
5
,
y0
[
2
]
=
{.
0
,
5
.
0
},
y1
[
2
]
=
{.
0
,
.
0
};
double
k
=
.
5
,
y0
[
2
]
=
{.
0
,
5
.
0
},
y1
[
2
]
=
{.
0
,
.
0
};
log_func
=
&
log
;
COMPARE
(.
0
,
10
.
0
)
COMPARE
(.
0
,
10
.
0
)
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment