Re: Substitution!!!
- To: mathgroup at smc.vnet.net
- Subject: [mg35666] Re: Substitution!!!
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 25 Jul 2002 04:45:55 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <ahlhov$s7t$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
could you please so kind to give valid Mathematica syntax in your mail ?
With
repl = Reverse /@
Reverse[ {S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, S12,
S13} ->
{1 + x,
1 + x + x^2,
1 + x + x^3,
1 + x^2 + x^3,
1 + x + x^6,
1 + x^3 + x^6,
1 + x + x^2 + x^4 + x^6,
1 + x + x^3 + x^4 + x^6,
1 + x^5 + x^6,
1 + x + x^2 + x^5 + x^6,
1 + x^2 + x^3 + x^5 + x^6,
1 + x + x^4 + x^5 + x^6,
1 + x^2 + x^4 + x^5 + x^6} // Thread];
and
expr = (1 + x) (1 + x + x^2)(1 + x + x^3) (1 + x + x^6) (1 + x^3 + x^6)
(1 +
x + x^2 + x^4 + x^6) (1 + x + x^3 + x^4 + x^6) (1 + x + x^2 +
x^5 +
x^6);
expr /. repl
gives
S1 S10 S2 S3 S5 S6 S7 S8
Since ReplaceAll[] tkae the first rule that match, you have to force
ReplaceAll[] to try the longer polynomials first, and so
The first rule in repl must be
1 + x^2 + x^4 + x^5 + x^6 -> S13
and *not*
1 + x -> S1
Regards
Jens
Chekad Sarami wrote:
>
> Hi,
>
> I have a question regarding substitute of an expression with index
> variables..I need to make a table for some products of irreducible
> polynomials (Irreducible factors of x^63 -1) . But they are so large and I
> can't fit them into the columns of my table. So I need to use these
> substitutions
>
> {S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10, S_11, S_12, S_13, S_14}
> : ------> {1 + x, 1 + x + x^2, 1 + x + x^3, 1 + x^2 + x^3, 1 + x + x^6,
> 1 + x^3 + x^6, 1 + x + x^2 + x^4 + x^6, 1 + x + x^3 + x^4 + x^6, 1 +
> x^5 + x^6, 1 + x + x^2 + x^5 + x^6, 1 + x^2 + x^3 + x^5 + x^6, 1 + x + x^4
> + x^5 + x^6, 1 + x^2 + x^4 + x^5 + x^6}
>
> ***** The right side is a list of irreducible polynomials which is assigned
> to {S_1, S_2,.... S_14}.*******
>
> For example instead of putting this large expression (1 + x) (1 + x + x^2)
> (1 + x + x^3) (1 + x + x^6) (1 + x^3 + x^6) (1 + x + x^2 + x^4 + x\^6) (1 +
> x + x^3 + x^4 + x^6) (1 + x + x^2 + x^5 + x^6) in my table I can write it in
> tems of S_i's in this form S_1 S_2 S_3 S_4 S_5 S_6 S_7 S_8.
>
> I tried ReplaceAll but it changes i.e. the above example to S_1 (S_1+x^3)
> (S_1+x_6) .... Which is not what I want.
>
> Can anybody tell me how to do this.
>
> Regards
>
> CHEKAD