역삼각함수란 삼각함수의 역함수를 의미하고,

역쌍곡선함수란 쌍곡선함수의 역함수를 의미한다.

수학에서 sin 함수의 역함수는 arcsin 으로 표기되는데,

Boo 언어에서는 닷넷에서 사용하는  Math.Asin() 함수를 쓰면 된다.

이를 사용하기 위해서는 import 구문

import System

이 필요하다.

 

Boo 언어는 Pytyhon 언어와 비슷하며, 닷넷 용이라는 점에서는 IronPython 과 더더욱 비슷하다.

다음 소스는 Boo 인타프리터 booi 로 실행해도 되고, Boo 컴파일러 booc 로 컴파일하여 생성된 실행 파일을 실행해도 된다. booc 로 컴파일이 성공적으로 끝나면 *.exe 파일과 *.pdb 파일이 생성된다.

#  Filename: testArcSine.boo
#
#   Execute: booi testArcSine.boo
#
#    Or
#
#   Compile: booc testArcSine.boo
#   Execute: testArcSine.boo
#
# Date: 2013. 1. 6.
# Copyright (c) pkim _AT_ scripts.pe.kr

import System

def asinh(x as double) as double:
    y = Math.Log(x + Math.Sqrt(x*x + 1))
    return y

def acosh(x as double) as double:
    y = Math.Log(x + Math.Sqrt(x*x - 1))
    return y


# 실행 시작 지점
x = -0.9
y = Math.Asin(x)
print string.Format("y = asin({0}) = {1:F9}", x,  y)
print string.Format("sin(y) = sin({0:F9}) = {1}", y, Math.Sin(y))
print

x = 1.1
u = acosh(x)
print string.Format("u = acosh({0}) = {1:F10}", x,  u)

v = asinh(x)
print string.Format("v = asinh({0}) = {1:F10}", x,  v)

print string.Format("cosh(u) = cosh({0:F10}) = {1}", u,  Math.Cosh(u))
print string.Format("sinh(v) = sinh({0:F10}) = {1}", v,  Math.Sinh(v))

/*
Output:
y = asin(-0.9) = -1.119769515
sin(y) = sin(-1.119769515) = -0.9

u = acosh(1.1) = 0.4435682544
v = asinh(1.1) = 0.9503469298
cosh(u) = cosh(0.4435682544) = 1.1
sinh(v) = sinh(0.9503469298) = 1.1
*/

 

 

Posted by Scripter
,