{
  "__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": "nf",
              "annotation": "int or float or complex or ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Double factorial of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", as integer, float or complex (depending on "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "exact"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "extend"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "). Array inputs are returned as arrays."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Double factorial."
            }
          ]
        }
      ],
      "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": "n",
              "annotation": "int or float or complex (or array_like thereof)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Input values for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n!!"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Non-integer values require "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "extend='complex'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". By default, the return value for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n < 0"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "exact",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "exact"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is set to True, calculate the answer exactly using integer arithmetic, otherwise use above approximation (faster, but yields floats instead of integers). Default is False."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extend",
              "annotation": "string, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "One of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'zero'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'complex'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "; this determines how values "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n<0"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are handled - by default they are 0, but it is possible to opt into the complex extension of the double factorial. This also enables passing complex values to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "warning",
                  "base_type": "warning",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "warning "
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Using the "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "'complex'"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " extension also changes the values of the double factorial for even integers, reducing them by a factor of "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "sqrt(2/pi) ~= 0.79"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ", see [1]."
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This is the factorial with every second value skipped.  E.g., "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "7!! = 7 * 5 * 3 * 1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  It can be approximated numerically as    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "n!! = 2 ** (n / 2) * gamma(n / 2 + 1) * sqrt(2 / pi)  n odd\n    = 2 ** (n / 2) * gamma(n / 2 + 1)                 n even\n    = 2 ** (n / 2) * (n / 2)!                         n even",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The formula for odd "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the basis for the complex extension."
            }
          ]
        }
      ],
      "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": "/scipy/special/_basic.py",
  "item_line": 2996,
  "item_type": "function",
  "aliases": [
    "scipy.special.factorial2"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.special import factorial2\nfactorial2(7, exact=False)\nfactorial2(7, exact=True)\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "n",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "exact",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "extend",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "zero"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "factorial2"
  },
  "references": [
    ".. [1] Complex extension to double factorial",
    "        https://en.wikipedia.org/wiki/Double_factorial#Complex_arguments"
  ],
  "qa": "scipy.special._basic:factorial2",
  "arbitrary": [],
  "local_refs": [
    "exact",
    "extend",
    "n",
    "nf"
  ]
}