{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "0c6d6dde",
            "cell_type": "markdown",
            "source": "<div class='alert alert-warning'>\n\nSciPy's interactive examples with Jupyterlite are experimental and may not always work as expected. Execution of cells containing imports may result in large downloads (up to 60MB of content for the first import from SciPy). Load times when importing from SciPy may take roughly 10-20 seconds. If you notice any problems, feel free to open an [issue](https://github.com/scipy/scipy/issues/new/choose).\n\n</div>",
            "metadata": {}
        },
        {
            "id": "ce191ec4",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.stats import pmean, hmean, gmean\npmean([1, 4], 1.3)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "2.639372938300652"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "e3711a15",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "pmean([1, 2, 3, 4, 5, 6, 7], 1.3)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "4.157111214492084"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "121b2b68",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "pmean([1, 4, 7], -2, weights=[3, 1, 3])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "1.4969684896631954"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "c2993319",
            "cell_type": "markdown",
            "source": "For p=-1, power mean is equal to harmonic mean:\n",
            "metadata": {}
        },
        {
            "id": "3c6b80c2",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "pmean([1, 4, 7], -1, weights=[3, 1, 3])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "1.9029126213592233"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "5390a620",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "hmean([1, 4, 7], weights=[3, 1, 3])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "1.9029126213592233"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "9fb1e225",
            "cell_type": "markdown",
            "source": "For p=0, power mean is defined as the geometric mean:\n",
            "metadata": {}
        },
        {
            "id": "c5480872",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "pmean([1, 4, 7], 0, weights=[3, 1, 3])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "2.80668351922014"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "5eaee7b3",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "gmean([1, 4, 7], weights=[3, 1, 3])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "2.80668351922014"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}