Mathematica Mathematica - get value of function at certain x

Click For Summary
The discussion revolves around using Mathematica to evaluate a fitted function at multiple parameter values stored in a text file. The user has fitted a polynomial function to 100 original data points and wants to generate 800 values based on new parameters. The solution involves reading the parameter values into an array and applying the function to the entire array, which can be done using the syntax f[data_array]. The user acknowledges finding a solution on the Mathematica community forum and suggests that the topic may not need to remain in the homework section. The conversation highlights the ease of evaluating functions with arrays in Mathematica.
skrat
Messages
740
Reaction score
8
Hi,

I am not really sure this is the right topic to post my question in, but it is homework so...

To my data in txt file I fitted a function ##f(x)## where ##x\in [0,100]##. In the original file I had only 100 points, but now that I have a nice polynomial fit, I can get infinite number of points (on that function).

And that is exactly what I want to do. For example:

Code:
f[0.5]
returns me coordinates. (The argument in the code is parametrization of the fitted function from 0 to 1)

Now my question is:

From 100 original points, I need 800. And I have those 800 parameter values exactly defined in another txt file, let's call it values.txt. So the question is: How do I tell Mathematica to evaluate the fitted function at all the parametrization values in values.txt file? :/

Hopefully you understand what I need. I know it is simple, but I can't find it anywhere.
 
Last edited by a moderator:
Physics news on Phys.org
First - I believe this belongs in one of the homework threads - and someone should move it.

I don't have Mathematica handy, but once you read the 800 values into an array, I believe you can just f[data_array] and it will generate an array of 800 values, each of which is f applied to an element in data_array.
Try it out, I can't.
 
This topic can be REmoved, not only moved. I found a solution on Mathematica community.

Thanks anyway!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
833
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K