1
Solve[Sum[p*a[i], {i, 1, n}] == 0, p, Reals]


Solve[p*Sum[a[i], {i, 1, n}] == 0, p, Reals]

The first line of code cannot be solved, but when the variable p is extracted and turned into the second line of code, it can be solved. What is the reason for this? How can the first line of code (i.e. using the original form) be made to run correctly?

xzczd
  • 65,995
  • 9
  • 163
  • 468
Yilin Cheng
  • 109
  • 5
  • 1
    What is the value of n for the first case? Put n=4 and try again. – Syed Nov 12 '23 at 03:13
  • @Syed if put a given number(such as n=4), the first code can solve. – Yilin Cheng Nov 12 '23 at 03:20
  • As far as I know, currently none of those arithmetic related functions (Solve, Simplify, Limit, …) can handle unevaluated Sum. (Of course, there existed rather rare exception: https://mathematica.stackexchange.com/a/78777/1871 ) The best solution I can think out is to code a shell as I've done here: https://mathematica.stackexchange.com/a/71393/1871 – xzczd Nov 12 '23 at 03:20
  • @xzczd Thank you very much, I need to learn the solution you mentioned. – Yilin Cheng Nov 12 '23 at 03:28
  • Two other related posts: https://mathematica.stackexchange.com/q/96952/1871 https://mathematica.stackexchange.com/q/129545/1871 – xzczd Nov 12 '23 at 03:44
  • @xzczd https://mathematica.stackexchange.com/a/198186/94893 It seems that the problem has not been solved very well. I found that changing __Plus to __Times did not yield accurate results. Perhaps I cannot directly modify the code? – Yilin Cheng Nov 12 '23 at 04:02
  • @xzczd now I try to learn use the first post in“ Sum not recognized as a linear operator by Solve ” – Yilin Cheng Nov 12 '23 at 04:04
  • You don't need to modify anything. Just use the expandSums. – xzczd Nov 12 '23 at 04:05
  • @xzczd the solution"expandSums" in "https://mathematica.stackexchange.com/a/198193/94893". it is work for me ,very thanks!!!!!!!!!!! – Yilin Cheng Nov 12 '23 at 04:27

0 Answers0