-
Notifications
You must be signed in to change notification settings - Fork 7
/
functions.f90
50 lines (30 loc) · 880 Bytes
/
functions.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
! $MYHPSC/homework3/functions.f90
module functions
! parameters for module
! implicit none
! real(kind=8) :: pi
! save
contains
real(kind=8) function f_sqrt(x)
implicit none
real(kind=8), intent(in) :: x
f_sqrt = x**2 - 4.d0
end function f_sqrt
real(kind=8) function fprime_sqrt(x)
implicit none
real(kind=8), intent(in) :: x
fprime_sqrt = 2.d0 * x
end function fprime_sqrt
real(kind=8) function f_function(x)
implicit none
real(kind=8), intent(in) :: x
real(kind=8) :: pi = 3.141592653589793
f_function = (x*cos(pi*x))-(1.0d0-(0.6d0*(x**2)))
end function f_function
real(kind=8) function fprime_function(x)
implicit none
real(kind=8), intent(in) :: x
real(kind=8) :: pi = 3.141592653589793
fprime_function = ((-x*pi)*sin(pi*x))+cos(pi*x)+(1.2d0*x)
end function fprime_function
end module functions