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.

Tags: , , , ,

 
 
 

4 Comments

  1. I don’t understand – are these native functions of javascript, or are you discussing some framework or some such?

  2. Chip says:

    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.

  3. 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?

  4. Chip says:

    No. You should define ‘x’ first. The formulas will calculate different results (based on what you need), based on the value of ‘x’.

Leave a Reply





 
CommentLuv Enabled
 
  • John William: Very informative article! I was wondering that can we submit more arti...
  • CSS Gallery: Great research on these resources! We noticed you didn’t include ht...
  • ramyad: Great! Finally, found a solution. I've been scratching my head on this...
  • san diego seo: There is a new guy on my soccer team who is an Englishman. From time t...
  • Spyke: Thanks for posting this. Many people don't realize that bridge does th...
    follow me on Twitter

    Last searched terms

    Top Browsers

    Top OS

    Site Stats

    Ads

    Ads

    Ajax CommentLuv Enabled 7cc703d7a351bbc1b554fad7c2b1c542 | Tots2Teens | Cariera Piatra Constanta | Verighete