Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Trying to define a integrating function in Mathematica

  1. Jun 11, 2016 #1
    I need to define a function that integrates a function in some interval and returns its numerical value. I am not allowed to use built in functions for integrating in Mathematica.

    This is my code that won't work:

    This is a code from a friend that works:

    We are both using Wolfram Mathematica 8.0. I don't know what's wrong with my code, and why I can't obtain a normal numerical result?
  2. jcsd
  3. Jun 11, 2016 #2
    It's solved guys. For anyone that might have the same problem here's the probable solution: go to the Evaluation tab and from there quit your local kernel. This will delete any saved symbolic or functional assignments you've given somewhere before in Mathematica.
    Specifically in my problem, I defined a function f as something else somewhere before, and didn't erase the assignment, and then when I tried to run the program for integrating it gave me the trash result you can see in the screenshot. You can see that the program is repeating the part with f[x] in it in the expression, which indicates that the function f is probably assigned to something else that's blocking the correct evaluation of the program.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted