An architect wants to construct a vaulted building supported by a family of arches Cn.

fn(x) = -nx - xlog(x) is the equation of the arch Cn where `x` is a positive real number (0 < x <= 1), `log(x)` is the natural logarithm (base e), `n` a non negative integer. Let fn(0) = 0.

Be An the point of Cn where the tangent to Cn is horizontal and Bn+1 the orthogonal projection of An on the x-axis (it means that An and Bn+1 have the same x -coordinate). 
Kn is the intersection of Cn with the x-axis. 

The figure shows C0, A0, B1, K0 as C(0), A0, B1, K0. 

![alternative text](https://i.imgur.com/Td9aWIJ.png)

The architect wants to support each arch Cn with a wall of glass filling the **curved** surface An Bn+1 Kn under the curve Cn.
On the drawing you can see the surface `A0 B1 K0` in blue.

He asks if we could calculate the weight of the surface of glass he needs to support all arches C0...Cn where n is a positive integer knowing he can choose glass thickness hence glass weight per square unit of surface.

He gives us the absolute value of A0 B1 K0 area (in blue); call it `i0` which is approximately `0.14849853757254047` in square units.

## Task
Write the function `weight` with parameters `n` and `w` where `n` is the number of arches to consider (n >= 1) and `w` is the weight of a square unit of glass depending on the wall thickness. 

This function should return the weight of n glass walls as described above.

## Example
```
weight(10, 700) -> 120.21882500408238
weight(8, 1108) -> 190.28922301858418
```
## Hint:
There is no integral to calculate. You can plot C1 and try to see the relationship between the different Cn and then use `i0`.

## Note: 
- don't round or truncate your result

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def weight(n, w):
	

Solutions:
weight = lambda n, w, e=__import__('math').exp(-2): (1 - 3 * e) / (1 - e) / 4 * (1 - e ** n) * w


from math import e

def weight(n, w):
	total = 1
	for i in range(1, n + 1):
		total += e ** (-2 * i)
	return w * 0.14849853757254047 * total


def weight(n, w):
	from math import e
	i0 = 0.14849853757254047
	an = (1 - e ** (-(2 * n + 2))) / (1 - e ** (-2))
	return i0 * an * w


def weight(n, w):
	return 0.171741178625167 * w


weight = lambda *_: _[-1] / 5.8227


import decimal

def weight(n, w):
	I0 = decimal.Decimal(0.14849853757254047)
	OFFSET = decimal.Decimal(7.389056098930639)
	return float((OFFSET - 1 / OFFSET ** n) / (OFFSET - 1) * w * I0)


i0 = 0.14849853757254047
from math import exp

def weight(n, w):
	area = i0 * sum([exp(-2 * m) for m in range(n)])
	return w * area


import math

def weight(n, w):
	area = 0
	for n in range(0, n):
		Bn = math.exp(-1 - n)
		Kn = math.exp(-n)
		if Kn < 1e-300 or Bn < 1e-300:
			n += 1
		else:
			aire = 0.5 * (n * Bn ** 2 - n * Kn ** 2 + (Kn ** 2 - Bn ** 2) / 2 + Bn ** 2 * math.log(Bn) - Kn ** 2 * math.log(Kn))
		area += aire
	return area * w


from math import exp

def weight(n, w):
	return w / 4 * (1 - 3 * exp(-2)) * (1 - exp(-2 * n - 4)) / (1 - exp(-2))


def weight(n, w):
	i0 = 0.14849853757254
	eConst = 2.71828182845904
	eInvConstSq = 1 / eConst ** 2
	nPartialWeight = 0
	nPartialSurface = i0
	for iArch in range(1, n + 1):
		nPartialWeight = nPartialWeight + iArch * nPartialSurface * w * (1 - eInvConstSq)
		nPartialSurface = nPartialSurface / eConst ** 2
	return nPartialWeight


import math

def weight(n, w):
	x0 = math.exp(-1)
	i0 = 0.14849853757254047
	p = i0
	for i in range(1, n + 1):
		x = math.exp(-i - 1)
		k = x / x0
		p += i0 * k * k
	return p * w


i0 = 0.14849853757254047
r = 0.1353352832366127

def weight(n, w):
	return w * i0 * (1 - pow(r, n)) / (1 - r)


import math

def weight(n, w):
	i0 = 0.14849853757254047
	return i0 * w * (1 - math.exp(-2 * n)) / (1 - math.exp(-2))


from math import e

def weight(n, w):
	return -0.17174117862516716 * (e ** (-2 * n) - 1) * w


from math import exp

def weight(N, w):
	return sum((0.25 * exp(-2 * (n + 1)) * (exp(2) - 3) for n in range(N))) * w


import math
import decimal

def weight(n, w):
	weight = 0
	i0 = 0.14849853757254047
	fundamental_constant_of_glass_windows = 0.135335283237
	while n >= 0:
		weight += i0 * fundamental_constant_of_glass_windows ** n * w
		n -= 1
	return weight


import math

def weight(n, w):
	i0 = (1 - 3 * math.exp(-2)) / 4
	iScale = [math.exp(-2 * k) for k in range(n + 1)]
	return w * i0 * sum(iScale)


from math import exp
weight = lambda n, w: w * (1 - exp(-2 * n)) * 0.17174117862516716


(weight, H) = (lambda Q, S: (H - 3) * (1 - H ** (-Q)) / (H - 1) * S / 4, 7.389)