Trying to define a integrating function in Mathematica

  • #1
29
0

Main Question or Discussion Point

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?
 

Answers and Replies

  • #2
29
0
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?
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.
 

Related Threads for: Trying to define a integrating function in Mathematica

Top