I hereby claim:
- I am tswedish on github.
- I am tswedish (https://keybase.io/tswedish) on keybase.
- I have a public key ASBmF9szOq6XhfbyhBf4NY1dTFdefEIf91vI5vstfqE7Ugo
To claim this, I am signing this object:
def __add__(self, other): | |
if isinstance(other, self.__class__): | |
return Variable(lambda a,b : a+b, (self, other)) | |
else: | |
return Variable(lambda a,b : a+b, (self, Variable(other))) |
for x in [-1., 0.5, 3.]: | |
print('Function Input: {}'.format(x)) | |
print('Function Value: {}'.format(super_complicated_function(x))) | |
print('Function Symbolic Derivative: {}'.format(d_super_complicated_function(x))) | |
x_v = Variable(x) | |
L = super_complicated_function(x_v) | |
print('Variable Function Output Value: {}'.format(L)) | |
L.backward() | |
print('Input value: {}'.format(x_v)) | |
print('-'*32) |
def fn(x): | |
return x**2 + 0.2*(x-2)**5 + 2*x**3 | |
# initialization | |
x = Variable(3.) | |
target = 42. | |
print('---- Initial Value ----') | |
print('fn(x): {}'.format(fn(x))) | |
print('Target: {}'.format(target)) | |
print('intial guess for x: {}'.format(x)) |
def super_complicated_function(x): | |
return x * sin(x+6.)**2. / 2. - 2. / 2.**x |
I hereby claim:
To claim this, I am signing this object: