Я пытаюсь получить root функции, используя метод деления пополам, но я получаю эту ошибку:
if (call (f(a))==0 .or. call (f(a))<=error) then
1
Error: Function 'call' at (1) has no implicit type
Я не знаю, как решить проблему.
program biseccion
real::a,b,raiz
print*,"Escribar el valor a del intervalor[a,b]"
read*,a
print*,"Escribar el valor b del intervalor[a,b]"
read*,b
call bis(a,b,raiz)
print*,raiz
Contains
function f(x) result(f_result)
real,intent(in)::x
real::f_result
f_result=x**(3)+2*x**(2)+10*x-20 !Escribir la funcion
end function f
subroutine bis(a,b,raiz)
real,intent(in)::a,b
real,intent(out)::raiz
real,parameter::error=epsilon(error)
do
if (call (f(a))==0 .or. call (f(a))<=error) then
raiz=call(f(a))
exit
else if (call (f(b))==0 .or. call (f(b))<=error) then
raiz=call (f(b))
else if (call (f(a)) <0 .and. call (f(b))>0) then
if (call (f(a/2)) <0) then
a=a/2
else
b=b/2
end if
else if (call (f(a)) >0 .and. call (f(b))<0 ) then
if (call (f(a/2)) >0) then
a=a/2
else
b=b/2
end if
end if
end do
end subroutine bis
end program biseccion