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

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:
    http://pokit.org/get/?93856fe8f2070ba781028f8634b9ac3a.jpg

    This is a code from a friend that works:
    http://pokit.org/get/?d712a81fb8c3078f4d8ad60a43b7bf0e.jpg

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted