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
836e82fe
Commit
836e82fe
authored
Feb 18, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected derivatives.
parent
c9d726c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
modsim/ass2/q4.c
modsim/ass2/q4.c
+3
-5
No files found.
modsim/ass2/q4.c
View file @
836e82fe
...
@@ -14,7 +14,7 @@ double f1(double x) {
...
@@ -14,7 +14,7 @@ double f1(double x) {
}
}
double
df1
(
double
x
)
{
double
df1
(
double
x
)
{
return
x
/
2
-
1
;
return
2
*
x
-
1
;
}
}
double
f2
(
double
x
)
{
double
f2
(
double
x
)
{
...
@@ -22,7 +22,7 @@ double f2(double x) {
...
@@ -22,7 +22,7 @@ double f2(double x) {
}
}
double
df2
(
double
x
)
{
double
df2
(
double
x
)
{
return
(
x
*
x
)
/
3
-
3
;
return
3
*
x
*
x
-
3
;
}
}
double
f3
(
double
x
)
{
double
f3
(
double
x
)
{
...
@@ -30,11 +30,9 @@ double f3(double x) {
...
@@ -30,11 +30,9 @@ double f3(double x) {
}
}
double
df3
(
double
x
)
{
double
df3
(
double
x
)
{
return
(
x
*
x
+
1
)
+
(
x
/
2
)
*
(
x
-
4
);
return
(
x
*
x
+
1
)
+
2
*
x
*
(
x
-
4
);
}
}
#define TEST(i) (printf("f1: %.11f\n", &f(i), &df(i), 1))
int
main
(
void
)
{
int
main
(
void
)
{
printf
(
"f1: %.11f
\n
"
,
newton
(
&
f1
,
&
df1
,
1
));
printf
(
"f1: %.11f
\n
"
,
newton
(
&
f1
,
&
df1
,
1
));
...
...
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