testEval_prg Program

program~~testeval_prg~~UsesGraph program~testeval_prg testEval_prg module~kinds_mod kinds_mod module~kinds_mod->program~testeval_prg module~plplotlib_mod plplotlib_mod module~kinds_mod->module~plplotlib_mod module~array_mod array_mod module~kinds_mod->module~array_mod module~expression_mod expression_mod module~kinds_mod->module~expression_mod module~text_mod text_mod module~kinds_mod->module~text_mod module~time_mod time_mod module~kinds_mod->module~time_mod module~treetrigonometric_mod treeTrigonometric_mod module~kinds_mod->module~treetrigonometric_mod module~treeexponential_mod treeExponential_mod module~kinds_mod->module~treeexponential_mod module~treeoperator_mod treeOperator_mod module~kinds_mod->module~treeoperator_mod module~node_mod node_mod module~kinds_mod->module~node_mod module~treevalue_mod treeValue_mod module~kinds_mod->module~treevalue_mod module~plplotlib_mod->program~testeval_prg module~array_mod->program~testeval_prg module~array_mod->module~plplotlib_mod module~expression_mod->program~testeval_prg plplot plplot plplot->module~plplotlib_mod module~text_mod->module~plplotlib_mod module~text_mod->module~node_mod module~time_mod->module~text_mod iso_fortran_env iso_fortran_env iso_fortran_env->module~text_mod iso_c_binding iso_c_binding iso_c_binding->module~time_mod module~treetrigonometric_mod->module~expression_mod module~treeexponential_mod->module~expression_mod module~treeoperator_mod->module~expression_mod module~node_mod->module~expression_mod module~node_mod->module~treetrigonometric_mod module~node_mod->module~treeexponential_mod module~node_mod->module~treeoperator_mod module~node_mod->module~treevalue_mod module~treevalue_mod->module~expression_mod
Help


Test program for eval_mod

Calls

program~~testeval_prg~~CallsGraph program~testeval_prg testEval_prg proc~testfunction testFunction program~testeval_prg->proc~testfunction proc~setup setup proc~testfunction->proc~setup proc~dofunction doFunction proc~testfunction->proc~dofunction proc~show show proc~testfunction->proc~show plsfnam plsfnam proc~setup->plsfnam plsetopt plsetopt proc~setup->plsetopt plsfam plsfam proc~setup->plsfam plfontld plfontld proc~setup->plfontld plinit plinit proc~setup->plinit plsdev plsdev proc~setup->plsdev proc~xylim xylim proc~dofunction->proc~xylim proc~subplot subplot proc~dofunction->proc~subplot proc~linspace linspace proc~dofunction->proc~linspace proc~ticks ticks proc~dofunction->proc~ticks proc~figure figure proc~dofunction->proc~figure interface~span span proc~dofunction->interface~span interface~mixval mixval proc~dofunction->interface~mixval proc~labels labels proc~dofunction->proc~labels proc~plot plot proc~dofunction->proc~plot plend plend proc~show->plend plwind plwind proc~xylim->plwind pladv pladv proc~subplot->pladv plvasp plvasp proc~subplot->plvasp plssub plssub proc~subplot->plssub plvpor plvpor proc~subplot->plvpor plvsta plvsta proc~subplot->plvsta plbox plbox proc~ticks->plbox proc~figure->pladv proc~figure->plssub plbop plbop proc~figure->plbop pleop pleop proc~figure->pleop pllab pllab proc~labels->pllab plline plline proc~plot->plline plptex plptex proc~plot->plptex plssym plssym proc~plot->plssym
Help

Source Code


Subroutines

subroutine testFunction()

Verify operation of newFunction and eval

Arguments

None

subroutine doFunction(s, r)

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: s
real(kind=wp), intent(in), dimension(2):: r

Source Code

program testEval_prg
	!! Test program for eval_mod
	use kinds_mod
	use expression_mod
	use array_mod
	use plplotlib_mod
	implicit none
	
	call testFunction
	
contains

	subroutine testFunction
		!! Verify operation of newFunction and eval
		call setup(fileName='testsExpression-%n.svg',figSize=[400,300])
		
! 		call doFunction('f(x) = x+1j',[-2.0_wp,2.0_wp])
		
		call doFunction('f(x) = x+1',[-2.0_wp,2.0_wp])
		call doFunction('f(x) = x-1',[-2.0_wp,2.0_wp])
		call doFunction('f(x) = 2*x',[-2.0_wp,2.0_wp])
		call doFunction('f(x) = x/2',[-2.0_wp,2.0_wp])
		call doFunction('f(x) = x^2',[-2.0_wp,2.0_wp])
		
		call doFunction('f(x) = sqrt(x^2)',[-2.0_wp,2.0_wp])
		call doFunction('f(x) = abs(x)',[-2.0_wp,2.0_wp])
		call doFunction('f(x) = exp(x)',[0.0_wp,1.0_wp])
		call doFunction('f(x) = log(exp(x))',[0.0_wp,1.0_wp])
		call doFunction('f(x) = sin(x)',[0.0_wp,2.0_wp*PI])
		call doFunction('f(x) = asin(sin(x))',[0.0_wp,2.0_wp*PI])
		call doFunction('f(x) = cos(x)',[0.0_wp,2.0_wp*PI])
		call doFunction('f(x) = acos(cos(x))',[0.0_wp,2.0_wp*PI])
		
		call doFunction('f(x) = 2*(x+1)/3',[0.0_wp,2.0_wp*PI])
		call doFunction('f(x) = (x+1)*(x-1)/6',[0.0_wp,2.0_wp*PI])
		call doFunction('f(x) = 4*(x+1)/(x^2+1)',[0.0_wp,2.0_wp*PI])
		
		call show()
	end subroutine testFunction

	subroutine doFunction(s,r)
		character(*),intent(in)::s
		real(wp),dimension(2),intent(in)::r
		
		integer,parameter::N = 150
		type(function_t)::f
		real(wp),dimension(N)::x,y
		integer::k
		
		f = function_t(s)
		
		write(*,*) f%str
		
		x = linspace(r(1),r(2),N)
		do k=1,N
			y(k) = f%eval([x(k)])
		end do
		
		call figure()
		call subplot(1,1,1,aspect=span(y)/span(x))
		call xylim(mixval(x),mixval(y)+0.05_wp*[-1.0_wp,1.0_wp*span(y)])
		call plot(x,y,lineColor='r',lineWidth=2.0_wp)
		call ticks()
		call labels('x','y',s)
		
	end subroutine doFunction

end program testEval_prg