Ask Your Question

Problem to calculate arcsin(5/24*cos(45)) to a real number

asked 2022-11-20 12:12:12 +0100

pfeifhns gravatar image

updated 2022-11-24 15:00:17 +0100

slelievre gravatar image

When I enter the expression arcsin(5/24*cos(45)) in a Jupyter Notebook running the Sage kernel, I "only" receive arcsin(5/24*cos(45)).

I want to have the expression as a real number, but I don't know how to tell Sage that I want this expression to be calculated.

edit retag flag offensive close merge delete


You can use real numbers in the calculation to get a real number result, namely arcsin(5/24*cos(45.0))

tolga gravatar imagetolga ( 2022-11-24 10:37:09 +0100 )edit

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2022-11-24 15:00:28 +0100 )edit

Thank you very much for your answer, it was very helpful.

pfeifhns gravatar imagepfeifhns ( 2022-11-26 10:25:29 +0100 )edit

You can click the check mark next to an answer to mark it as the accepted answer.

Ideally, if you have comments on an answer, post them as comments rather than as a new answer.

slelievre gravatar imageslelievre ( 2022-11-26 12:54:06 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2022-11-24 14:57:56 +0100

slelievre gravatar image

updated 2022-11-26 12:58:38 +0100

In Sage as in most math software, angles are measured in radians, not degrees.

So if by cos(45) you mean the cosine of 45 degrees, use cos(pi/4) instead.

The next thing is that Sage aims to give exact results for exact input.

sage: a = arcsin(5/24*cos(pi/4))
sage: a

To get a floating-point approximation for your computation, two choices.

  • First, you can compute exactly and then take a numerical approximation.

    For this, use the numerical_approx method or its shortcut n.

    sage: a.numerical_approx()
    sage: a.n()
  • Second, you can compute in floating-point all the way.

    For this, start by using a floating point approximation of pi.

    sage: b = asin(5/24*cos(pi.n()/4))
    sage: b
edit flag offensive delete link more

answered 2022-11-24 08:59:45 +0100

Emmanuel Charpentier gravatar image

updated 2022-11-24 09:17:09 +0100

I want to have the expression as a real number

arcsin(5/24*cos(45)) is a Sage object representing the quantity you want to manipulate; its value is a real number+. What you are seeking is a numerical approximation of this quantity expressed as a decimal representation. Which can be obtained by :

sage: numerical_approx(arcsin(5/24*cos(45)))


sage: arcsin(5/24*cos(45)).n()

Try numerical_approx?...

  • Note that there are an infinity of complex values whose $\sin$ is 5/24*cos(45) ; the mathematical function $\arcsin$ is multivalued. The Sage function arcsin implement aparticular choice of this branch cut, returning a value in the interval $[-\frac\pi2\ \frac\pi2]$.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2022-11-20 12:12:12 +0100

Seen: 133 times

Last updated: Nov 26 '22