%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/polynomial-1.2.0"
title: >
  A Polynomial model.

description: |
  A polynomial model represented by its coefficients stored in
  an ndarray of shape $(n+1)$ for univariate polynomials or $(n+1, n+1)$
  for polynomials with 2 variables, where $n$ is the highest total degree
  of the polynomial.

  $$P = \sum_{i, j=0}^{i+j=n}c_{ij} * x^{i} * y^{j}$$

  Invertibility: This transform is not automatically invertible.

examples:
  -
    - $P = 1.2 + 0.3 * x + 56.1 * x^{2}$
    - asdf-standard-1.6.0
    - |
        !transform/polynomial-1.2.0
          coefficients: !core/ndarray-1.1.0
                          [1.2, 0.3, 56.1]
  -
    - $P = 1.2 + 0.3 * x + 3 * x * y + 2.1 * y^{2}$
    - asdf-standard-1.6.0
    - |
        !transform/polynomial-1.2.0
          coefficients: !core/ndarray-1.1.0
                          [[1.2, 0.0, 2.1],
                           [0.3, 3.0, 0.0],
                           [0.0, 0.0, 0.0]]

allOf:
  - $ref: "transform-1.3.0"
  - type: object
    properties:
      coefficients:
        description: |
          An array with coefficients.
        anyOf:
          - $ref: "../core/ndarray-1.1.0"
          - $ref: "../unit/quantity-1.2.0"
          - type: array
    required: [coefficients]
...
