Many times in Linkedin (or in your email) you may find images like these:
or
(courtesy of https://www.linkedin.com/pulse/solve-you-genius-stebin-chacko )
The latter annoys us a lot. Because the first is just a system (write in geometrical symbol instead of math symbols).
But why instead of write 8 = f(2,2) and finally what’s f(9,9), use this non sense notation 2+2 = 8 in the second one?
By the way, if we wanna talk of the matter:
the second quiz is very intuitive.
It should be solve with a machine learning algorith as linear regression (if not immediatly solve with basic math).
What’s about the first?
Using the derivative, can bo solved by iteration.
The Python code:
# -*- coding: utf-8 -*-
“”” Equations:
s**3 = 27
t**3 + s = 24
s * t * c**2 = 96Solutions s = 3 t = 2 c = 4 “””
import numpy as np
s, t, c = 1, 1, 1 # inizializzo
print s, t, c
def J(s, t, c):
# J = cost_function = (s**3 – 27)**2 + ( t**3 + s – 24 )**2 + (s * t * c**2 – 96 )**2
# = Σ (h_i – y )²
return (s**3 – 27)**2 + ( t**3*s -24 )**2 + (s* t* c**2 – 96)**2# grad = [ ∂J/∂s, ∂J/∂t, ∂J/∂c] # Chain Rule (in a different form) f(g(x)) f’(g(x))g’(x)
alfa = .0003for i in range(40): # actualizo los parametros
deriv_s = 2* (s**3 -27)* (2*s**2) +2*(t**3* s -24)* (t**3) +2*(s* t* c**2 – 96)* (t* c**2)
s = s – alfa * deriv_s
deriv_t = 2*(t**3* s -24)* (3* t**2* s) +2*(s* t* c**2 – 96)* (s* c**2)
t = t – alfa * deriv_t
deriv_c = 2*(s* t* c**2 – 96)* (s* t* 2*c)
c = c – alfa * deriv_cprint “\r\tThe cost function is: “, J(s,t,c)
print “\t\tThe actual values of roots are:”, round(s,3), round(t,3), round(c,3)print “\nThe search roots are: “, c, s, t
“””solve c + s * t = ? “””
print “\n\t The search result is: “, c + s * t
In conclusion, we would like to use correctly linkedin (no as facebook).