문제

I've been trying to create my own JavaScript program for solving problems in Calculus such as taking the derivative of an equation, but as of yet have not succeeded. I would be greatly appreciative if someone could help me with this.

도움이 되었습니까?

해결책

Something like that should do it

function poly(variable, degree){
 return degree*((variable)^(degree-1));
}

You shoud store your polynomial of degree n in an (n+1) 'array' and using Jquery each method

var result = 0;
$.each(array, function(index, value) {
  result = result + poly(value,index);
});

Edit : if you don't know about jquery, you can use pure javascript for loop, for (var i = 0; i < myArray.length; i++) {...}

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top