update weighted SM function
add derivatives