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};
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?

  • $\begingroup$ No. It is a function or a list of functions. $\endgroup$ – minhthien_2016 Jul 4 at 7:46
  • $\begingroup$ @HighPerformanceMark Please try with list = {x^2 - 3 x, x^3 + 5 x}; $\endgroup$ – minhthien_2016 Jul 4 at 7:49
  • $\begingroup$ @HighPerformanceMark I saw my bug in syntax. $\endgroup$ – minhthien_2016 Jul 5 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};
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}}).

  • $\begingroup$ How can I input the function extra into the table? $\endgroup$ – minhthien_2016 Jul 5 at 1:58
  • $\begingroup$ I did Table[{extra, {x, extra} /. Solve[D[extra, x] == 0, x, Reals]}, {extra, list1}] $\endgroup$ – minhthien_2016 Jul 5 at 2:15
  • $\begingroup$ @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. $\endgroup$ – MassDefect Jul 5 at 2:22
  • $\begingroup$ 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? $\endgroup$ – minhthien_2016 Jul 14 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.