tfp.math.atan_difference
Stay organized with collections
Save and categorize content based on your preferences.
Difference of arctan(x) and arctan(y).
tfp.math.atan_difference(
x, y, name=None
)
Computes arctan(x) - arctan(y) avoiding catastrophic cancellation. This is
by resorting to the identity:
arctan(x) - arctan(y) = arctan((x - y) / (1 + x * y)) +
pi * sign(x) * 1_{x * y < -1)
where 1_A
is the indicator function on the set A
.
For a derivation of this fact, see [1].
References
[1] De Stefano, Sum of Arctangents
https://sites.google.com/site/micdestefano/mathematics/trigonometry/sum-of-arctangents
Args |
x
|
Floating-point Tensor. Should be broadcastable with y .
|
y
|
Floating-point Tensor. Should be broadcastable with x .
|
name
|
Optional Python str naming the operation.
|
Returns |
z
|
Tensor of same shape and dtype as x and y .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.math.atan_difference\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/math/special.py#L52-L91) |\n\nDifference of arctan(x) and arctan(y). \n\n tfp.math.atan_difference(\n x, y, name=None\n )\n\nComputes arctan(x) - arctan(y) avoiding catastrophic cancellation. This is\nby resorting to the identity: \n\n arctan(x) - arctan(y) = arctan((x - y) / (1 + x * y)) +\n pi * sign(x) * 1_{x * y \u003c -1)\n\nwhere `1_A` is the indicator function on the set `A`.\n\nFor a derivation of this fact, see \\[1\\].\n\n#### References\n\n\\[1\\] De Stefano, Sum of Arctangents\n\u003chttps://sites.google.com/site/micdestefano/mathematics/trigonometry/sum-of-arctangents\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|----------------------------------------------------------|\n| `x` | Floating-point Tensor. Should be broadcastable with `y`. |\n| `y` | Floating-point Tensor. Should be broadcastable with `x`. |\n| `name` | Optional Python `str` naming the operation. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----|------------------------------------------------|\n| `z` | Tensor of same shape and dtype as `x` and `y`. |\n\n\u003cbr /\u003e"]]