relationalai.std.math.asin()
asin(number: Number|Producer) -> Expression
Calculates the inverse sine (arcsine) of number
, where number
is specified in radians and must be in the range -1
to 1
.
If number
is a Producer
, asin()
filters out any non-number or invalid values from the producer.
Must be called in a rule or query context.
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
number | Producer or Python Number object | The value to calculate the arcsine of, in the range -1 to 1 . |
Returns
Section titled “Returns”An Expression
object.
Example
Section titled “Example”Use asin()
to calculate the arcsine of a value in radians:
import relationalai as raifrom relationalai.std import math
# =====# SETUP# =====
model = rai.Model("MyModel")Satellite = model.Type("Satellite")
with model.rule(): Satellite.add(id=1).set(name="SatA", orientation=0.5) Satellite.add(id=2).set(name="SatB", orientation=1.0) Satellite.add(id=3).set(name="SatC", orientation=-1.5) # Out of range Satellite.add(id=4).set(name="SatD", orientation="INVALID") # Non-numeric value
# =======# EXAMPLE# =======
# Set an orientation_asin property to the arcsine of each satellite's orientation.with model.rule(): satellite = Satellite() satellite.set(orientation_asin=math.asin(satellite.orientation))
# Since asin() filters out non-numeric or out-of-range values, the orientation_asin# property is not set for satellites with IDs 3 and 4.with model.query() as select: satellite = Satellite() response = select(satellite.id, satellite.name, satellite.orientation_asin)
print(response.results)# id name orientation_asin# 0 1 SatA 0.523599# 1 2 SatB 1.570796# 2 3 SatC NaN# 3 4 SatD NaN