Re: Good documentation

new topic     » goto parent     » topic index » view thread      » older message » newer message

Shian Lee, I agree that you selected a topic that needs much work.

I have begun a re-write of the arcsin function.

More elaborate (real world) examples belong in a tutorial of some kind. I can come up with lots of examples from physics, navigation, surveying, ... but that would also require an explanation of the technical background behind each example. Bloated tutorial examples do not belong in regular documentation. That just says that I should write a few books.

I downloaded Quick Basic, maybe I'll find the documentation you have mentioned.

The o[4 PDF has about 700 pages. If only I can upgrade one page per day...

_tom


trig_range

include arcsin.e 
public type trig_range(object x) 

values passed to arccos and arcsin must be in the inclusive range [-1,+1]

arcsin

include arcsin.e 
public function arcsin(trig_range x) 

returns an angle in a right triangle given its sine.

Arguments:
  1. trig_range : an atom or a sequence of atomic items; each value is a trig_range ratio.
Returns:

An object, the same shape as trig_range, each atom is an angle measured in radians.

Errors:

The arcsin function requires arguments in the inclusive [ -1..1 ] range; a typecheck error occurs otherwise.

Comments:
 
             /|   
hypotenuse c/ | a opposite  
           /__| 
          A  b adjacent 
      angle 
 
 The right triangle abc 

The arcsin (angle in radians) is the inverse function of the sin (ratio of a/c ) function .

The argument to the arcsin function must be in the inclusive range of -1 to +1 .

The return value is an angle, measured in radians, in the inclussive range of -PI/2 to +PI/2 .

The arcsin may be applied to an atom or to all atomic items in a sequence.

Note:

The arcsin function is not as fast as the arctan function.

Example 1:
s = arcsin({-1,0,1}) 
? s 
--> {-1.570796327, 0, 1.570796327} 
 
include std/mathcon.e 
? PI/2 
--> 1.570796327 
Example 2:

In the right triangle

 
             /|   
hypotenuse 5/ | 4 opposite  
           /__| 
          A  3 adjacent 
      angle 
 
 The right triangle abc 

the sine of A is opposite/hypotenuse. Given the ratio 4/5, what is the angle A in radians?

                                                     include std/math.e 
atom r = arcsin( 4/5 ) 
? r 
--> 0.927295218 
r = rad2deg(r) 
? r 
--> 53.13010235 
See Also:

arccos | arctan | sin | PI | rad2deg | deg2rad

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu