{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "Ak",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Even or odd Fourier coefficients, corresponding to even or odd m. The number of coefficients returned is determined by an empirical formula that depends on "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "m"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "q"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Fourier coefficients for even Mathieu and modified Mathieu functions."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "m",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Order of Mathieu functions.  Must be non-negative."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "q",
              "annotation": "float (>=0)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Parameter of Mathieu functions.  Must be non-negative."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Fourier series of the even solutions of the Mathieu differential equation are of the form"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "\\mathrm{ce}_{2n}(z, q) = \\sum_{k=0}^{\\infty} A_{(2n)}^{(2k)} \\cos 2kz"
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "\\mathrm{ce}_{2n+1}(z, q) =\\sum_{k=0}^{\\infty} A_{(2n+1)}^{(2k+1)} \\cos (2k+1)z"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function returns the coefficients "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "A_{(2n)}^{(2k)}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for even input m=2n, and the coefficients "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "A_{(2n+1)}^{(2k+1)}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for odd input m=2n+1."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "build-install/usr/lib/python3.14/site-packages/scipy/special/_basic.py",
  "item_line": 1689,
  "item_type": "function",
  "aliases": [
    "scipy.special.mathieu_even_coef"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "We use the Fourier coefficients to construct an approximation of\n``mathieu_cem(5, 14, x)``, the even Mathieu function of order `m = 5` and\nparameter `q = 14`.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.special import mathieu_even_coef, mathieu_cem\nm = 5\nq = 14\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n``a`` holds the Fourier coefficients.  As noted above, the number of\ncoefficients returned by ``mathieu_even_coef(m, q)`` is based on an\nempirical formula that depends on `m` and `q`.  In this case, we get\n29 coefficients.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "a = mathieu_even_coef(m, q)\na.shape\n",
        "execution_status": "success",
        "out": "(29,)\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nSum the Fourier cosine series on a grid of ``x`` values.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "period = 180 if m % 2 == 0 else 360\nx = np.linspace(0, period, 5000)             # x has shape (5000,)\nk = np.arange(len(a)).reshape((-1, 1))       # k has shape (len(a), 1)\nc = np.cos((2*k + m % 2) * (np.pi/180) * x)  # c has shape (len(a), 5000)\ny = a @ c                                    # y has shape (5000,)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nPlot the approximation, along with the function computed directly by\n``mathieu_cem(m, q, x)``.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.plot(x, y, 'k--', label=\"Fourier sum\")\n",
        "execution_status": "failure",
        "out": "[<matplotlib.lines.Line2D object at 0x7f3f591e97f0>]\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ce, _dce = mathieu_cem(m, q, x)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.plot(x, ce, alpha=0.35, linewidth=3.5, label=\"mathieu_cem\")\n",
        "execution_status": "failure",
        "out": "[<matplotlib.lines.Line2D object at 0x7f3f591e9940>]\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.grid(True)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.title(f'Mathieu Function $\\\\rm{{ce_{m}}}(x, {q})$')\nplt.xlabel('x [degrees]')\nplt.legend(shadow=True, loc='upper left', bbox_to_anchor=(1, 1))\n",
        "execution_status": "failure",
        "out": "<matplotlib.legend.Legend object at 0x7f3f591e9550>\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.tight_layout()\nplt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "2.0.0.dev0+git20260907.41eeb59",
          "kind": "assets",
          "path": "fig-0921db08f13fc107.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "mathieu_cem",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.special._mathieu:mathieu_cem"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "mathieu_odd_coef",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.special._basic:mathieu_odd_coef"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "m",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "q",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "mathieu_even_coef"
  },
  "references": [
    ".. [1] Zhang, Shanjie and Jin, Jianming. \"Computation of Special",
    "       Functions\", John Wiley and Sons, 1996.",
    "       Original source code hosted by John Burkardt:",
    "       https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html",
    ".. [2] NIST Digital Library of Mathematical Functions",
    "       https://dlmf.nist.gov/28.4#i"
  ],
  "qa": "scipy.special._basic:mathieu_even_coef",
  "arbitrary": [],
  "local_refs": [
    "Ak",
    "m",
    "q"
  ]
}