relationalai.std.math.acot()
acot(number: Number|Producer) -> Expression
Calculates the inverse cotangent (arccotangent) of number
, where number
is specified in radians.
If number
is a Producer
, acot()
filters out any non-number 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 arccotangent of. |
Returns
Section titled “Returns”An Expression
object.
Example
Section titled “Example”Use acot()
to calculate the arccotangent 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="INVALID") # Non-numeric value
# =======# EXAMPLE# =======
# Set an orientation_acot property to the arccotangent of each satellite's orientation.with model.rule(): satellite = Satellite() satellite.set(orientation_acot=math.acot(satellite.orientation))
# Since acot() filters out non-numeric values, the orientation_acot property# is not set for the satellite with ID 3.with model.query() as select: satellite = Satellite() response = select(satellite.id, satellite.name, satellite.orientation_acot)
print(response.results)# id name orientation_acot# 0 1 SatA 1.107149# 1 2 SatB 0.785398# 2 3 SatC NaN