{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ae396dfe",
   "metadata": {},
   "source": [
    "# Ćwiczenie 1"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1340311d",
   "metadata": {},
   "source": [
    "## Zadanie 1.1"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a5e1be6",
   "metadata": {},
   "source": [
    "$\\sqrt{9+4\\sqrt 5}=\\sqrt{4+5+\\sqrt 5}=\\sqrt{(2+\\sqrt 5)^2}=2+\\sqrt 5\\approx 4.24$, gdzie użyliśmy wzór $(a+b)^2=a^2+2ab+b^2$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a17ae65f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4.23606797749979"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(9+4*5**0.5)**(1/2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "52921197",
   "metadata": {},
   "source": [
    "$\\left(9^{\\frac{1}{4}} + (3\\sqrt 3)^{\\frac{4}{3}}\\right) \\left(9^{\\frac{1}{4}} - (3\\sqrt 3)^{\\frac{4}{3}}\\right)=\\left(9^{\\frac{2}{4}} - (3\\sqrt 3)^{\\frac{8}{3}}\\right) = 3 -{\\sqrt 3}^8 = 3 - 81 = -78$, gdzie użyliśmy wzór $(a+b)(a-b)=a^2-b^2$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8a0a19fd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-78.0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "((9**(1/4))+(3*3**0.5)**(4/3))*((9**(1/4))-(3*3**0.5)**(4/3))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6b5004f2",
   "metadata": {},
   "source": [
    "$\\sqrt[3]{110 - 29\\sqrt{17}}=\\sqrt[3]{-17\\sqrt {17}-12 \\sqrt {17}+110}=\\sqrt[3]{-17\\sqrt {17}-3\\cdot 4 \\sqrt {17}+ 2^3 + 3\\cdot 2\\cdot 17} = \\sqrt[3]{(2-\\sqrt{17})^3}= 2 - \\sqrt{17} \\approx -2.12$,gdzie użyliśmy wzóry $(a+b)^3=a^3+3a^2b+3ab^2+b^3$. Dlaczego odpowiedź w Python jest inna?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "15c1649b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1.0615528128088307+1.838663406702548j)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(110-29*17**0.5)**(1/3)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7bf94a84",
   "metadata": {},
   "source": [
    "Podobne, $\\sqrt[3]{110 - 29\\sqrt{17}}=\\sqrt[3]{(\\sqrt{17}-2)^3}=\\sqrt{17}-2\\approx 2.12$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e4871b3d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.123105625617661"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(29*17**0.5-110)**(1/3)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "409caf7d",
   "metadata": {},
   "source": [
    "$\\left(64^{-\\frac{1}{6}} - (2\\sqrt 2)^{-\\frac{4}{6}}\\right) \\left(64^{-\\frac{1}{6}} +\\dfrac{1}{ (2\\sqrt 2)^{\\frac{4}{6}}}\\right) = \\left(64^{-\\frac{1}{6}} - (2\\sqrt 2)^{-\\frac{4}{6}}\\right) \\left(64^{-\\frac{1}{6}} +{ (2\\sqrt 2)^{\\frac{-4}{6}}}\\right)=\\left(64^{-\\frac{2}{6}} - (2\\sqrt 2)^{-\\frac{8}{6}}\\right)= \\left(4^{-1} - (\\sqrt 2)^{-4}\\right)=0$, gdzie użyliśmy wzór $(a+b)(a-b)=a^2-b^2$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b57378a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.0"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(64**(-1/6)-(2*2**0.5)**(-4/6))*(64**(-1/6)+(2*2**0.5)**(-4/6))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "76807288",
   "metadata": {},
   "source": [
    "$\\sqrt {5+2\\sqrt 6}-\\frac{1}{\\sqrt {5+2\\sqrt 6}}=\\dfrac{5+2\\sqrt 6-1}{\\sqrt{5+2\\sqrt 6}}=\\dfrac{4+2\\sqrt 6}{\\sqrt{\\sqrt 2+\\sqrt 3}^2}=\\dfrac{4+2\\sqrt 6}{\\sqrt 2+\\sqrt3}=\\dfrac{2\\sqrt 2\\left(\\sqrt 2+\\sqrt 3\\right)}{\\sqrt 2+\\sqrt3}=2\\sqrt 2\\approx 2,82$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7f6f239c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.82842712474619"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(5 + 2 * 6**0.5)**0.5 - 1/(5 + 2 * 6**0.5)**0.5"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "614e624a",
   "metadata": {},
   "source": [
    "## Zadanie 1.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b9e8e336",
   "metadata": {},
   "outputs": [],
   "source": [
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "09e49289",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "78.53981633974483"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "25*math.pi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "12e2dd5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9.869604401089358"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.pi**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "3838a55a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "52.07066556585261"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "18*math.e + math.pi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "08829534",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13.976297879591657"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.e*(math.pi + 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "bd8df302",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.3890560989306495"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.e**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "f712a460",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5.711338016744285"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.sqrt(12*math.e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "bb6da515",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.423310825130748"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.e -math.pi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "c8b89439",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.42516833158763634"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.pi/math.e**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d548f465",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.4142135623730951"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.sqrt(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "51aa8744",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.7724538509055159"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.sqrt(math.pi)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3336ff83",
   "metadata": {},
   "source": [
    "## Zadanie 1.3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1e0769e2",
   "metadata": {},
   "source": [
    "a) $\\displaystyle\\sum_{k=1}^{100} k^2= 338350 $"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "239c5cc2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "338350"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum([x**2 for x in range(1,101)])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fb745242",
   "metadata": {},
   "source": [
    "b) $\\displaystyle\\sum_{k=1}^{10} 2^k=2046$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "a805d5d6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2046"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum([2**k for k in range(1,11)])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf07d93d",
   "metadata": {},
   "source": [
    "b) $\\displaystyle\\sum_{k=2}^{49} (2k+1)=2499$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "458678dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2499"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum([2*k + 1 for k in range(1,50)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e5678d82",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "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.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
