{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "96b1bd28",
   "metadata": {},
   "source": [
    "# 05-13 · Корни и расстояния\n",
    "\n",
    "Практика к разделу [«Корни и расстояния»](../../site/chapters/glava-05/05-13-korni-rasstoyaniya.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "516c5896",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить math.isqrt(), math.hypot() и math.dist() на геометрических задачах."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e03ae28d",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "53a07ebe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:53.592551Z",
     "iopub.status.busy": "2026-08-16T12:02:53.592413Z",
     "iopub.status.idle": "2026-08-16T12:02:53.613995Z",
     "shell.execute_reply": "2026-08-16T12:02:53.613056Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5.0\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "print(math.hypot(3, 4))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "45ba5836",
   "metadata": {},
   "source": [
    "## Эксперимент 1\n",
    "\n",
    "Сравните isqrt() с обычным sqrt()."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ea8357d5",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:53.615441Z",
     "iopub.status.busy": "2026-08-16T12:02:53.615277Z",
     "iopub.status.idle": "2026-08-16T12:02:53.618135Z",
     "shell.execute_reply": "2026-08-16T12:02:53.617508Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.1622776601683795\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "print(math.sqrt(10))\n",
    "print(math.isqrt(10))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a867d62",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Найдите расстояние между точками (0, 0) и (6, 8) через math.dist() и выведите результат."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1cb07593",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:53.619336Z",
     "iopub.status.busy": "2026-08-16T12:02:53.619204Z",
     "iopub.status.idle": "2026-08-16T12:02:53.621941Z",
     "shell.execute_reply": "2026-08-16T12:02:53.621412Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10.0\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "A = (0, 0)\n",
    "B = (6, 8)\n",
    "print(math.dist(A, B))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
