Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In Octave

octave.exe:4> asin(1/2)
ans =  0.52360

is it possible to get the result in form of:

ans = pi/6

It seems not possible with format function, but may be there are any tricks.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I assume it's the same as with Matlab, where you would do sym(asin(1/2)).

share|improve this answer
This relies on the symbolic toolbox in matlab, so probably you will need a package like described here: math.stackexchange.com/questions/128812/… –  Dennis Jaheruddin Nov 21 '12 at 12:31

An alternative might be to convert into units of $\pi$ explicitly, and then seek a rational approximation:

> rats(asin(1/2) / pi)                                                                                                                                    
ans =       1/6
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.