Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97864728
zero_t.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
Mon, Jan 6, 22:28
Size
1 KB
Mime Type
text/x-c
Expires
Wed, Jan 8, 22:28 (2 d)
Engine
blob
Format
Raw Data
Handle
23423222
Attached To
R1448 Lenstool-HPC
zero_t.c
View Options
#include<stdio.h>
#include<math.h>
#include<fonction.h>
#include<constant.h>
#include<dimension.h>
#include<structure.h>
/****************************************************************/
/* nom: zero (methode des tangentes) */
/* auteur: Jean-Paul Kneib */
/* date: 10/11/93 */
/* place: Toulouse */
/****************************************************************
* Global variables used :
* - none
*/
double
zero_t
(
double
c1
,
double
c2
,
double
(
*
f
)(
double
))
{
double
dc
,
c
,
fc
,
c0
,
fc0
,
tang
,
errc
=
.005
;
double
fc1
,
fc2
;
int
end
=
0
,
nb
=
0
;
fc1
=
(
*
f
)(
c1
);
fc2
=
(
*
f
)(
c2
);
if
(
fabs
(
fc1
)
<
fabs
(
fc2
))
{
c
=
c2
;
c2
=
c1
;
c1
=
c
;
fc
=
fc2
;
fc2
=
fc1
;
fc1
=
fc
;
};
do
{
nb
++
;
tang
=
(
c2
-
c1
)
/
(
fc2
-
fc1
);
c0
=
c2
-
fc2
*
tang
;
if
(
c0
>
1.
)
{
end
=
1
;
c1
=
c2
=
0.8
;
}
else
if
(
c0
<
0.
)
{
end
=
1
;
c1
=
c2
=
0.
;
}
else
{
fc0
=
(
*
f
)(
c0
);
if
((
fc0
*
fc2
)
<
0
)
{
c1
=
c0
;
fc1
=
fc0
;
}
else
if
(
fabs
(
fc0
)
<
fabs
(
fc2
))
{
c1
=
c2
;
fc1
=
fc2
;
c2
=
c0
;
fc2
=
fc0
;
}
else
end
=
1
;
};
dc
=
fabs
(
c1
-
c2
);
}
while
((
end
==
0
)
&&
(
dc
>
errc
)
&&
(
nb
<
50
));
return
((
c1
+
c2
)
/
2.
);
}
Event Timeline
Log In to Comment