# How can I calculate the value f(x) in this table?

I am trying to find f(0) and f(3) to list them into a table, but I can not get that values. That is mean, I want to list the points (0, 0) and (3, -(9/2)) into table. I can not the correct result. My code

list = {x^2 - 3 x};
Clear[pA];
list1 = Table[pA = points;
Integrate[pA, x], {points, list}];
Table[f[x_] := extra;
{f[x], sol = Solve[D[f[x], x] == 0, x, Reals]; x1 = x /. sol[[1]];
x2 = x /. sol[[2]]; {x1, f[x1]}, {x2, f[x2]}}, {extra, list1}]


I only get

{{-((3 x^2)/2) + x^3/ 3, {0, -((3 x^2)/2) + x^3/3}, {3, -((3 x^2)/2) + x^3/3}}}

How can I get the correct result?

• No. It is a function or a list of functions. – minhthien_2016 Jul 4 '19 at 7:46
• @HighPerformanceMark Please try with list = {x^2 - 3 x, x^3 + 5 x}; – minhthien_2016 Jul 4 '19 at 7:49
• @HighPerformanceMark I saw my bug in syntax. – minhthien_2016 Jul 5 '19 at 8:14

I think that using SetDelayed and suppressing the output with ; on every iteration of Table is probably not the best way to handle evaluating this particular loop.

You could try:

list = {x^2 - 3 x};
Clear[pA]
list1 = Table[Integrate[points, x], {points, list}];
Table[{x, extra} /. Solve[D[extra, x]==0, x, Reals], {extra, list1}]


or, more succinctly:

list = {x^2 - 3 x};
list1 = Integrate[#, x]&/@list;
{x, #} /. Solve[D[#, x] == 0, x, Reals]&/@list1


The output of either is {{{0, 0}, {3, -9/2}}}. With your updated example in the comments, the output becomes {{{0, 0}, {3, -(9/2)}}, {{0, 0}}} meaning that output[[1]] is the set of solutions to the first equation, and output[[2]] is the set of solutions to the second equation (of course there appears to only be one solution for the second equation, but it's still represented as {{0, 0}}).

• How can I input the function extra into the table? – minhthien_2016 Jul 5 '19 at 1:58
• I did Table[{extra, {x, extra} /. Solve[D[extra, x] == 0, x, Reals]}, {extra, list1}] – minhthien_2016 Jul 5 '19 at 2:15
• @minhthien_2016 Ah, sorry, I didnâ€™t see that part of the question. But, yes, that should be an effective way to include the function itself. – MassDefect Jul 5 '19 at 2:22
• How can I calculate are of the triangle OAB, where O(0,0), A and B are extra points of the graph of the function? – minhthien_2016 Jul 14 '19 at 3:02