human
1. Error propagation (found online)
Imagine you have data with error bounds $x = 20 ± 0.1$ and $y = 30 ± 0.2$.  What is the result of $x + y$?
For addition or subtraction, if
$$
Q = a + b - c - d
$$
then if the error in $a$ is $\delta a$, then the error in $Q$ is
$$
\delta Q = \sqrt{ (\delta a)^2 + (\delta b)^2 +(\delta c)^2 +(\delta c)^2}
$$"
Please write code following the instructions in jupyter notebook style.
assistant
#Here is code to 1.

%%cython
from libc.math cimport sqrt

cdef class Unsure:
    cdef double value
    cdef double error
    def __init__(self, double value, double error=0):
        self.value = value
        self.error = error
        
    def __add__(x, y):
        if not isinstance(x, Unsure) or not isinstance(y, Unsure):
            raise Exception('Bad Types')
    
        cdef Unsure px = <Unsure>x
        cdef Unsure py = <Unsure>y
        
        cdef Unsure result = Unsure(0)
        result.value = px.value + py.value
        result.error = sqrt(px.error**2 + py.error**2)
        return result
    
    def __repr__(self):
        return '{:.6g} ± {:.3g}'.format(self.value, self.error)

x = Unsure(21.5, 0.5)
print(x)

y = Unsure(47.5, 0.5)
print(y)

x + y

x + 5