- New Addition to adButterfly Network FeaturedJuly 9, 2010
- Fresh Wallpapers Featured, GraphicsSeptember 4, 2009
- Whiskey Air Theme Featured, Themes, WordPressSeptember 2, 2009
Numerical Integration Using JavaScript
Instructions
- Use * to indicate multiplication: Type 4*x for 4x;
- Use ^ to indicate powers: Type 4*x^3 for 4×3; 12*x^-6 for 12x−6.
- Use parentheses to delimit the argument of a function; i.e., type sin(x) rather than sin x.
- Use parentheses to define the scope of an operation: For example, type 4*x*(x^2+1)^3 for 4x(x2+1)3; 4^(2*x+1) for 42x+1; (sin(x))^2 for (sin(x))2.
- Do not type sin^2(x) for sin2(x), type (sin(x))^2 instead.
- Do not use brackets [ ] or braces { }, use only parentheses to delimit a mathematics expression.
- Functions you may use:
– Trig: sin, cos, tan, cot, sec, csc;
– Inverse Trig: asin, acos, atan;
– Log/exponential: ln (naturall og), or use log; exp, the naturalexp onential; Note: You can also enter the natural exponential exp(x) as e^x for ex.
– Misc.: sqrt, usage sqrt(x) for √x (or, use exponential notation: x^(1/2)).
When you enter your response, some attempt will be made to determine whether the response is a valid one. For example, if you say san(x), the function ‘san’ will not be recognized as a valid mathematicalfunction; an error message is generated, and the user is not penalized for a possible typing error. The JavaScript routines will also check for unbalanced parentheses; thus, ((x^4+1) + sin(x)^2 will be flagged as a syntax error.
Important: The only variable used is x; do not enter any other undefined symbols into your answer.
Tweet This
Digg This
Save to delicious
Stumble it
RSS Feed
4 Comments
I don’t understand – are these native functions of javascript, or are you discussing some framework or some such?
No, it’s just examples on how to use mathematical functions. I am working on some JavaScript game and I’m using mathematical calculations. Here are some examples of mistakes, I’ve run into, and how to use parentheses, groups, and delimitations.
Ah, ok – I got confused when you said, ‘The only variable used is x; do not enter any other undefined symbols into your answer’ – do you mean you can use x without defining it?
No. You should define ‘x’ first. The formulas will calculate different results (based on what you need), based on the value of ‘x’.