Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94227172
three_eighths2.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 4, 22:24
Size
850 B
Mime Type
text/x-c
Expires
Fri, Dec 6, 22:24 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
22703720
Attached To
R1448 Lenstool-HPC
three_eighths2.c
View Options
#include <math.h>
#include "lt.h"
#define MYFUNC(x,y,z) ((*func)(x,y,z))
double
three_eighths2
(
double
a
,
double
b
,
double
c
,
double
d
,
int
N
,
double
(
*
func
)(
double
,
double
,
double
))
{
int
i
=
0
;
double
par1
=
c
;
double
par2
=
d
;
double
deltax
;
double
x
=
a
;
double
efe
;
double
integral
=
0.0
;
double
summ
=
0.0
;
double
peso
;
do
{
deltax
=
(
b
-
a
)
/
N
;
x
=
x
+
deltax
;
efe
=
MYFUNC
(
x
,
par1
,
par2
);
if
(
i
==
0
){
peso
=
(
3.0
*
deltax
)
/
8.0
;
}
else
if
(
i
==
N
){
peso
=
(
3.0
*
deltax
)
/
8.0
;
}
else
if
(
i
%
3
==
0
)
{
peso
=
(
9.0
*
deltax
)
/
8.0
;}
else
if
(
(
i
+
1
)
%
3
==
0
)
{
peso
=
(
9.0
*
deltax
)
/
8.0
;}
else
{
peso
=
(
6.0
*
deltax
)
/
8.0
;}
integral
=
efe
*
peso
;
summ
=
summ
+
integral
;
i
=
i
+
1
;
}
while
(
i
<=
N
);
return
(
summ
);
}
#undef MYFUNC(x,y,z) ((*func)(x,y,z))
Event Timeline
Log In to Comment