🇬🇧 Pwic.wiki server running on Python and SQLite

🏁 This page has been validated by wikipedia on 2023-04-28 at 00:00:01.

📌

Related pages: 🇫🇷 Démonstration

This page illustrates how the rendering of the pages looks like online.

# 1. Pythagorean theorem

## 1.1. Definition

In mathematics, the Pythagorean theorem is a fundamental relation in Euclidean geometry among the three sides of a right triangle. It states that the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares on the other two sides.

This theorem can be written as an equation relating the lengths of the sides a, b and c, often called the Pythagorean equation: 1

$a^2 + b^2 = c^2$

Another technical notation is: a2+b2=c2.

## 1.2. Visual representation

The sum of the areas of the two squares on the legs (a and b) equals the area of the square on the hypotenuse (c). The following picture is integrated in SVG format in the page as HTML:

## 1.3. Values

1 2 3 4 5 6 7 8 9 10
1 1,41
2 2,24 2,83
3 3,16 3,61 4,24
4 4,12 4,47 5,00 5,66
5 5,10 5,39 5,83 6,40 7,07
6 6,08 6,32 6,71 7,21 7,81 8,49
7 7,07 7,28 7,62 8,06 8,60 9,22 9,90
8 8,06 8,25 8,54 8,94 9,43 10,00 10,63 11,31
9 9,06 9,22 9,49 9,85 10,30 10,82 11,40 12,04 12,73
10 10,05 10,20 10,44 10,77 11,18 11,66 12,21 12,81 13,45 14,14

Exercise: if a=3 and b=5, then c=... ?

c = √34 ≈ 5,83

# 2. Script

## 2.1. Python

from math import sqrt try: a = float(input('Value of a = ')) b = float(input('Value of b = ')) c2 = a ** 2 + b ** 2 print('c = %.2f' % sqrt(c2)) except ValueError: print('Invalid value')

## 2.2. JavaScript

var a = parseFloat(prompt('Value of a =', '2')), b = parseFloat(prompt('Value of b =', '3')); alert('c = ' + Math.sqrt(a*a + b*b));