# Collapse a Sum / factor an element out of a sum

I am trying to get something in the form of a $\Sigma (\dots) * \alpha_i = (\dots)$ from the output of the code below. The thing is that I cannot figure out how to tell Mathematica to "collapse" down to a single sum and factor out the $\alpha_i$.

Thank you,

John

````$Assumptions = 
i \[Element] Integers && j \[Element] Integers && 
n \[Element] Integers && i \[Element] Constant && 
j \[Element] Constant && n \[Element] Constant;

r[t_] = (D[#, {t, 2}] - t*D[#, t] + 1/6*# - (-3)) &;
inner[x_] = (Integrate[
 Simplify[
  ComplexExpand[#1 Conjugate[#2], 
   TargetFunctions -> {Re, Im}]], {x, 0, 10}]) &;

uB = 5 - \[Pi]/5*x;
\[Phi][i_] = x^i*(10 - x);
uApp = uB + Sum[Subscript[\[Alpha], i]*\[Phi][i], {i, 1, n}];

(r[x][uApp] /. x -> (10 - 0)/(n + 1)*j) == 0
````
-

It's not clear to me what you mean by "collapsing down" - the $\alpha_i$ can't be factored out of the sum over $i$ because they depend on the summation index, don't they? – Jens Jan 22 at 3:56
I am not sure what you are trying to accomplish here. Are you trying to simplify the summand, or are you trying to factor a constant factor out of the sum entirely? Also, do you have a simpler example of your code, as the sum is getting lost in the details? (Yes, the pun was intended.) – rcollyer Jan 22 at 3:57
An unrelated issue is that you cannot declare variables as constants by saying `j \[Element] Constant && n \[Element] Constant`, because `Constant` isn't a domain of which something can be an element. To distinguish constants in a differentiation you don't have to do anything special. It's the opposite case that requires a little work - see here. – Jens Jan 22 at 4:11
Thank you for the responses. Currently, there are several summations, each linear in \alpha\$_i. I wanted to collapse these down to a single sum. – user1543042 Jan 22 at 15:26
lang-mma
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 4, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9038941860198975, "perplexity_flag": "head"}