# tfp.substrates.numpy.math.trapz

Integrate y(x) on the specified axis using the trapezoidal rule.

Computes ∫ y(x) dx ≈ Σ [0.5 (yk + y{k+1}) * (x_{k+1} - x_k)]

`y` Float `Tensor` of values to integrate.
`x` Optional, Float `Tensor` of points corresponding to the y values. The shape of x should match that of y. If x is None, the sample points are assumed to be evenly spaced dx apart.
`dx` Scalar float `Tensor`. The spacing between sample points when x is None. If neither x nor dx is provided then the default is dx = 1.
`axis` Scalar integer `Tensor`. The axis along which to integrate.
`name` Python `str` name prefixed to ops created by this function. Default value: `None`, uses name='trapz'.

Float `Tensor` integral approximated by trapezoidal rule. Has the shape of y but with the dimension associated with axis removed.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]