Message Boards Message Boards

0
|
5926 Views
|
11 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Expand polynomial

Posted 9 years ago

Hi - apologies in advance because this must be simple, but I have tried a long list of commands without getting closer ... I want to expand a polynomial, grouped in powers of the variable. EG: given w=1+bx+cx^2+dx^3 Then I'd like to do something like Collect[w^2] and get 1 + 2bx + (2c+c^2)x^2 + 2(d+bc)x^3 + .... everything I have tried just gives me (1+bx+cx^2+dx^3)^2 Thanks

POSTED BY: Alan Smith
11 Replies

enter image description here

POSTED BY: Simon Cadrin

enter image description here

POSTED BY: Simon Cadrin
Posted 9 years ago

Hi, the expanded form you show is what I am looking for, but I want it in terms of the unknown coefficients a, b, c etc. - and in terms of a power of w, because once I can get w^2 I will try to get the series 1 + w + w^2 + w^3 + maybe higher terms. Thanks

POSTED BY: Alan Smith

enter image description here

POSTED BY: Simon Cadrin
Posted 9 years ago

Thanks, but I want the output polynomial grouped by powers of x, so something like 1 +bx + (a^2+b...)x^2 + (......)x^3 + and so on?

POSTED BY: Alan Smith

enter image description here

POSTED BY: Simon Cadrin
Posted 9 years ago

That was just an example, I don't actually know the polynomial that might emerge, which is why I wanted to see if mathematica could do it. So to summarise, I have a general poly, like w= 1 +bx + cx^2 + dx^3 ... once I know what the right commands are, I will want to experiment with this. Then I want to make a series - 1 + w + w^2 + w^3 +... but again I might want to extend it further.

So I will input w= 1 +bx + cx^2 + dx^3, then I want the commands that will take 1 + w + w^2 + w^3 and output that result, grouped in powers of x - so I would expect (only as an example) something like 1 + (...)x + (....)x^2 + (.....)x^3 + ...still keeping it general, with the b,c etc coefficiants. Thanks

POSTED BY: Alan Smith
Posted 9 years ago

.

In[1]:= w = 1 + b*x + c*x^2 + d*x^3;
Collect[1 + w + w^2 + w^3, x]

Out[2]= 4 + 6 b x + (4 b^2 + 6 c) x^2 + (b^3 + 8 b c + 6 d) x^3 + (3 b^2 c + 4 c^2 + 8 b d) x^4 +
    (3 b c^2 + 3 b^2 d + 8 c d) x^5 + (c^3 + 6 b c d + 4 d^2) x^6 + (3 c^2 d + 3 b d^2) x^7 + 3 c d^2 x^8 + d^3 x^9
POSTED BY: Bill Simpson
Posted 9 years ago

Perfect! Many thanks Bill (I had tried Collect, must have done something wrong, maybe something earlier not cleared ....). By the way - am I the only one who wishes there was a 'ClearAll' command that cleared everything from the current workspace (document)? I know I can specify types to be cleared, but would prefer to have a 'complete reset' available - unless there is one I don't know of?

POSTED BY: Alan Smith
Posted 9 years ago

There is a ClearAll documented in the help system, but that only does it for specific names you give it.

You can try the menu bar

Evaluation->Quit Kernel->Local->Quit

and that should deal with most things.

POSTED BY: Bill Simpson
Posted 9 years ago

That's great, thanks again Bill.

POSTED BY: Alan Smith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract