trilib02.gms : tridclib의 외부 함수 테스트

설명

이 테스트는 외부 코사인과 사인(모두 rad와
grad)는 Delphi 라이브러리에 구현되어 내장 라이브러리와 동일한 방식으로 작동합니다.
버전.
또한 기능은 간단한 모델에서 사용됩니다.

기여자: L. Westermann

소형 모델 유형 :슬롯 게임


카테고리 : 슬롯 게임 테스트 라이브러리


메인 파일 : trilib02.gms 포함: 컴파일됨.inc[htmlprecomp.inc[html]

$title tridclib의 외부 함수 테스트(TRILIB02,SEQ=522)

$onText
이 테스트는 외부 코사인과 사인(모두 rad와
grad)는 Delphi 라이브러리에 구현되어 내장 라이브러리와 동일한 방식으로 작동합니다.
버전.
또한 함수는 간단한 모델에서 사용됩니다.

기여자: L. Westermann
$offText

* Unix에는 Delphi 컴파일러가 없습니다.
$if %system.filesys% == UNIX $set nocomp true
$ifThen nocomp 설정
* testlib에서 제공하는 사전 컴파일된 라이브러리 사용
$ batInclude precomp.inc tridclib
$else
* 소스 코드에서 라이브러리 컴파일
$ batIncludecompile.inc 트라이
$endIf

함수 myCos / myLib.Cosine /
         mySin / myLib.Sine /
         myPi / myLib.Pi /;

g / 1*360 / 설정
    h / CosInt 코사인 내재
         CosExtRad 코사인 외인(라디안)
         CosExtDeg 코사인 외인(도)
         SinInt 사인 고유
         SinExtRad 사인 외부(라디안)
         SinExtDeg 사인 외부(도) /
    hh / F 기능 값
         G 그라데이션 값
         H 헤세값
         GN 그라데이션 숫자
         HN 헤세 숫자 /;

매개변수 Deg(g) 각도 값
          Rad(g) 라디안 값
          테스트(g,h,hh);

Deg(g) = ord(g);
Rad(g) = ord(g)*pi/180;

옵션 FDDelta=1e-3;
Test(g,'CosInt' ,'F') = cos (Rad(g));
Test(g,'CosExtRad','F') = mycos(Rad(g));
Test(g,'CosExtDeg','F') = mycos(Deg(g),1);
Test(g,'SinInt' ,'F') = sin (Rad(g));
Test(g,'SinExtRad','F') = mysin(Rad(g));
Test(g,'SinExtDeg','F') = mysin(Deg(g),1);

Test(g,'CosInt' ,'G') = cos.grad (1: Rad(g));
Test(g,'CosExtRad','G') = mycos.grad(1: Rad(g));
Test(g,'CosExtDeg','G') = mycos.grad(1: Deg(g),1)*180/pi;
Test(g,'SinInt' ,'G') = sin.grad (1: Rad(g));
Test(g,'SinExtRad','G') = mysin.grad(1: Rad(g));
Test(g,'SinExtDeg','G') = mysin.grad(1: Deg(g),1)*180/pi;

Test(g,'CosInt' ,'H') = cos.hess (1:1: Rad(g));
Test(g,'CosExtRad','H') = mycos.hess(1:1: Rad(g));
Test(g,'CosExtDeg','H') = mycos.hess(1:1: Deg(g),1)*180/pi*180/pi;
Test(g,'SinInt' ,'H') = sin.hess (1:1: Rad(g));
Test(g,'SinExtRad','H') = mysin.hess(1:1: Rad(g));
Test(g,'SinExtDeg','H') = mysin.hess(1:1: Deg(g),1)*180/pi*180/pi;

Test(g,'CosInt' ,'GN') = cos.gradn (1: Rad(g));
Test(g,'CosExtRad','GN') = mycos.gradn(1: Rad(g));
Test(g,'CosExtDeg','GN') = mycos.gradn(1: Deg(g),1)*180/pi;
Test(g,'SinInt' ,'GN') = sin.gradn (1: Rad(g));
Test(g,'SinExtRad','GN') = mysin.gradn(1: Rad(g));
Test(g,'SinExtDeg','GN') = mysin.gradn(1: Deg(g),1)*180/pi;

Test(g,'CosInt' ,'HN') = cos.hessn (1:1: Rad(g));
Test(g,'CosExtRad','HN') = mycos.hessn(1:1: Rad(g));
Test(g,'CosExtDeg','HN') = mycos.hessn(1:1: Deg(g),1)*180/pi*180/pi;
Test(g,'SinInt' ,'HN') = sin.hessn (1:1: Rad(g));
Test(g,'SinExtRad','HN') = mysin.hessn(1:1: Rad(g));
Test(g,'SinExtDeg','HN') = mysin.hessn(1:1: Deg(g),1)*180/pi*180/pi;

스칼라
    error01 'mypi <> 파이';
set error02 'cos/sin <> mycos/mysin(rad)'
    error03 'cos/sin <> mycos/mysin (grad)';

error01 = abs(pi <> mypi) > 1e-12;

error02(g,'cos',hh) = abs(Test(g,'CosInt',hh) - Test(g,'CosExtRad',hh)) > 1e-5;
error02(g,'sin',hh) = abs(Test(g,'SinInt',hh) - Test(g,'SinExtRad',hh)) > 1e-5;
error03(g,'cos',hh) = abs(Test(g,'CosInt',hh) - Test(g,'CosExtDeg',hh)) > 1e-5;
error03(g,'sin',hh) = abs(Test(g,'SinInt',hh) - Test(g,'SinExtDeg',hh)) > 1e-5;

중단$(오류01+카드(오류02)+카드(오류03))
       오류01, 오류02, 오류03;

********************************************************************************

스칼라 삼모드 /0/;

변수 x;
방정식 e;

예.. sqr(mysin(x,trimode)) + sqr(mycos(x,trimode)) =e= 1;

모델 m /e/;

x.lo = 0; x.l=3*파이
nlp를 사용하여 m min x를 해결합니다.

중단$(abs(x.l-0)>1e-12) 'x<>0';

* 이제 라디안 대신 각도를 사용하여 동일한 작업을 수행합니다.
삼중 모드 = 1;
x.lo = 0; x.l=540;
nlp를 사용하여 m min x를 해결합니다.

중단$(abs(x.l-0)>1e-12) 'x<>0';