0
$\begingroup$

If $f = a^{24} (p-p/a)/r + 1 - r/(a\ p) + (r/(a\ p))^2 -(r/(a\ p))^3 + \ldots$ how do I get M to write $r/(a\ p) = x$ as P[x]?

This is a display problem, What I want M to do is just display it as a series

(i.e)

f = stuff +1 - (x) + X^2 - X^3 + X^4 +....
y = f/.{r/(a*p)-> X} 

obviously doesnt work.

Can you please direct me to the proper display sequence in Mathematica?

$\endgroup$
  • $\begingroup$ Try SeriesData. E.g. SeriesData[x, 0, {1, 1, 1/2, 1/6, 1/24, 1/120}, 0, 6, 1] $\endgroup$ – b3m2a1 Dec 8 '17 at 6:39
  • $\begingroup$ Could you please concretize your Example? If I understand your first lines right the subtitution should be r-> x a p which leads to an expression[x] $\endgroup$ – Ulrich Neumann Dec 8 '17 at 11:06
  • $\begingroup$ Putting on hold until OP clarifies what he wants. $\endgroup$ – J. M. will be back soon Apr 8 '18 at 3:50
1
$\begingroup$

A direct general solution(infinite summation included) approach can be achieved using Collect

Collect[ f /. r -> x a p, x, Simplify]
(* (x + (-1)^N x^(2 + N) + (-1 + a) a^22 (1 + x))/(x (1 + x)) *)
(* N->\[Infinity] ((-1 + a) a^22)/x + 1/(1 + x) *)
$\endgroup$
  • $\begingroup$ where is the variable x? $\endgroup$ – José Antonio Díaz Navas Dec 8 '17 at 14:40
  • $\begingroup$ ups, my answer is corrected! $\endgroup$ – Ulrich Neumann Dec 8 '17 at 20:28
0
$\begingroup$

If your series has $\infty$ terms, MMA can do the sum, and then:

f = a^24 (p - p/a)/r + Sum[(-1)^i (r/(a p))^i, {i, 0, \[Infinity]}];
FullSimplify@(f /. r -> x*(a p))

$\frac{(a-1) a^{22}}{x}+\frac{1}{x+1}$

If your series has a number $N$ of terms, again MMA can do the sum:

f = a^24 (p - p/a)/r + Sum[(-1)^i (r/(a p))^i, {i, 0, N}];
FullSimplify@(f /. r -> x*(a p))

$\frac{(a-1) a^{22} (x+1)+(-1)^N x^{N+2}+x}{x (x+1)}$

If you want to maintain the sum symbolically:

f = a^24 (p - p/a)/r + Inactivate[Sum[(-1)^i (r/(a*p))^i, {i, 0, N}]];
fin=FullSimplify@(f /. r -> x*(a p));
fin /. fin[[2, 1, 2]] -> Cancel@Activate@fin[[2, 1, 2]]

$\underset{i=0}{\overset{N}{\sum }}(-1)^ix^i+\frac{(a-1) a^{22}}{x}$

You can always Activate again the sum.

$\endgroup$

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