Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

802

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

866

867

868

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

966

967

968

969

970

971

972

973

974

975

976

977

978

979

980

981

982

983

984

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1022

1023

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057

1058

1059

1060

1061

1062

1063

1064

1065

1066

1067

1068

1069

1070

1071

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1139

1140

1141

1142

1143

1144

1145

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1169

1170

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182

1183

1184

1185

1186

1187

1188

1189

1190

1191

1192

1193

1194

1195

1196

1197

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1228

1229

1230

1231

1232

1233

1234

1235

1236

1237

1238

1239

1240

1241

1242

1243

1244

1245

1246

1247

1248

1249

1250

1251

r""" 

Finite Complex Reflection Groups 

""" 

#***************************************************************************** 

# Copyright (C) 2011-2015 Christian Stump <christian.stump at gmail.com> 

# 

# This program is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License as published by 

# the Free Software Foundation, either version 2 of the License, or 

# (at your option) any later version. 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

 

from sage.misc.abstract_method import abstract_method 

from sage.misc.all import prod 

from sage.misc.cachefunc import cached_method 

from sage.categories.category_with_axiom import CategoryWithAxiom 

from sage.categories.coxeter_groups import CoxeterGroups 

 

class FiniteComplexReflectionGroups(CategoryWithAxiom): 

r""" 

The category of finite complex reflection groups. 

 

See :class:`ComplexReflectionGroups` for the definition of complex 

reflection group. In the finite case, most of the information 

about the group can be recovered from its *degrees* and 

*codegrees*, and to a lesser extent to the explicit realization as 

subgroup of `GL(V)`. Hence the most important optional methods to 

implement are: 

 

- :meth:`ComplexReflectionGroups.Finite.ParentMethods.degrees`, 

- :meth:`ComplexReflectionGroups.Finite.ParentMethods.codegrees`, 

- :meth:`ComplexReflectionGroups.Finite.ElementMethods.to_matrix`. 

 

Finite complex reflection groups are completely classified. In 

particular, if the group is irreducible, then it's uniquely 

determined by its degrees and codegrees and whether it's 

reflection representation is *primitive* or not (see [LT2009]_ 

Chapter 2.1 for the definition of primitive). 

 

.. SEEALSO:: :wikipedia:`Complex_reflection_groups` 

 

EXAMPLES:: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: ComplexReflectionGroups().Finite() 

Category of finite complex reflection groups 

sage: ComplexReflectionGroups().Finite().super_categories() 

[Category of complex reflection groups, 

Category of finite groups, 

Category of finite finitely generated semigroups] 

 

An example of a finite reflection group:: 

 

sage: W = ComplexReflectionGroups().Finite().example(); W # optional - gap3 

Reducible real reflection group of rank 4 and type A2 x B2 

 

sage: W.reflections() # optional - gap3 

Finite family {1: (1,8)(2,5)(9,12), 2: (1,5)(2,9)(8,12), 

3: (3,10)(4,7)(11,14), 4: (3,6)(4,11)(10,13), 

5: (1,9)(2,8)(5,12), 6: (4,14)(6,13)(7,11), 

7: (3,13)(6,10)(7,14)} 

 

``W`` is in the category of complex reflection groups:: 

 

sage: W in ComplexReflectionGroups().Finite() # optional - gap3 

True 

""" 

def example(self): 

r""" 

Return an example of a complex reflection group. 

 

EXAMPLES:: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: ComplexReflectionGroups().Finite().example() # optional - gap3 

Reducible real reflection group of rank 4 and type A2 x B2 

""" 

from sage.combinat.root_system.reflection_group_real import ReflectionGroup 

return ReflectionGroup((1,1,3), (2,1,2)) 

 

class SubcategoryMethods: 

 

@cached_method 

def WellGenerated(self): 

r""" 

Return the full subcategory of well-generated objects of ``self``. 

 

A finite complex generated group is *well generated* if it 

is isomorphic to a subgroup of the general linear group 

`GL_n` generated by `n` reflections. 

 

.. SEEALSO:: 

 

:meth:`ComplexReflectionGroups.Finite.ParentMethods.is_well_generated` 

 

EXAMPLES:: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: C = ComplexReflectionGroups().Finite().WellGenerated(); C 

Category of well generated finite complex reflection groups 

 

Here is an example of a finite well-generated complex 

reflection group:: 

 

sage: W = C.example(); W # optional - gap3 

Reducible complex reflection group of rank 4 and type A2 x G(3,1,2) 

 

All finite Coxeter groups are well generated:: 

 

sage: CoxeterGroups().Finite().is_subcategory(C) 

True 

sage: SymmetricGroup(3) in C 

True 

 

.. NOTE:: 

 

The category of well generated finite complex 

reflection groups is currently implemented as an 

axiom. See discussion on :trac:`11187`. This may be a 

bit of overkill. Still it's nice to have a full 

subcategory. 

 

TESTS:: 

 

sage: TestSuite(W).run() # optional - gap3 

sage: TestSuite(ComplexReflectionGroups().Finite().WellGenerated()).run() # optional - gap3 

sage: CoxeterGroups().Finite().WellGenerated.__module__ 

'sage.categories.finite_complex_reflection_groups' 

 

We check that the axioms are properly ordered in 

``sage.categories.category_with_axiom.axioms`` and yield 

desired output (well generated does not appear):: 

 

sage: CoxeterGroups().Finite() 

Category of finite coxeter groups 

""" 

return self._with_axiom('WellGenerated') 

 

class ParentMethods: 

@abstract_method(optional=True) 

def degrees(self): 

r""" 

Return the degrees of ``self``. 

 

OUTPUT: a tuple of Sage integers 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,4) 

sage: W.degrees() 

(2, 3, 4) 

 

sage: W = ColoredPermutations(3,3) 

sage: W.degrees() 

(3, 6, 9) 

 

sage: W = ReflectionGroup(31) # optional - gap3 

sage: W.degrees() # optional - gap3 

(8, 12, 20, 24) 

""" 

 

@abstract_method(optional=True) 

def codegrees(self): 

r""" 

Return the codegrees of ``self``. 

 

OUTPUT: a tuple of Sage integers 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,4) 

sage: W.codegrees() 

(2, 1, 0) 

 

sage: W = ColoredPermutations(3,3) 

sage: W.codegrees() 

(6, 3, 0) 

 

sage: W = ReflectionGroup(31) # optional - gap3 

sage: W.codegrees() # optional - gap3 

(28, 16, 12, 0) 

""" 

 

def _test_degrees(self, **options): 

""" 

Test the method :meth:`degrees`. 

 

INPUT: 

 

- ``options`` -- any keyword arguments accepted by :meth:`_tester` 

 

EXAMPLES: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: W = ComplexReflectionGroups().Finite().example(); W # optional - gap3 

Reducible real reflection group of rank 4 and type A2 x B2 

sage: W._test_degrees() # optional - gap3 

 

sage: W = SymmetricGroup(5) 

sage: W._test_degrees() 

 

We now break the implementation of W.degrees and check that this is caught:: 

 

sage: W.degrees = lambda: (1/1,5) 

sage: W._test_degrees() 

Traceback (most recent call last): 

... 

AssertionError: the degrees should be integers 

 

sage: W.degrees = lambda: (1,2,3) 

sage: W._test_degrees() 

Traceback (most recent call last): 

... 

AssertionError: the degrees should be larger than 2 

 

We restore W to its normal state:: 

 

sage: del W.degrees 

sage: W._test_degrees() 

 

See the documentation for :class:`TestSuite` for more information. 

""" 

from sage.structure.element import parent 

from sage.rings.integer_ring import ZZ 

 

tester = self._tester(**options) 

degrees = self.degrees() 

tester.assertIsInstance(degrees, tuple, 

"the degrees method should return a tuple") 

tester.assertTrue(all(parent(d) is ZZ for d in degrees), 

"the degrees should be integers") 

tester.assertTrue(all(d >= 2 for d in degrees), 

"the degrees should be larger than 2") 

tester.assertEqual(len(degrees), self.rank(), 

"the number of degrees should coincide with the rank") 

tester.assertEqual(sum(d-1 for d in degrees), self.number_of_reflections(), 

"the sum of the degrees should be consistent with the number of reflections") 

 

def _test_codegrees(self, **options): 

""" 

Test the method :meth:`degrees`. 

 

INPUT: 

 

- ``options`` -- any keyword arguments accepted by :meth:`_tester` 

 

EXAMPLES: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: W = ComplexReflectionGroups().Finite().example(); W # optional - gap3 

Reducible real reflection group of rank 4 and type A2 x B2 

sage: W._test_codegrees() # optional - gap3 

 

sage: W = SymmetricGroup(5) 

sage: W._test_codegrees() 

 

We now break the implementation of W.degrees and check that this is caught:: 

 

sage: W.codegrees = lambda: (1/1,5) 

sage: W._test_codegrees() 

Traceback (most recent call last): 

... 

AssertionError: the codegrees should be integers 

 

sage: W.codegrees = lambda: (2,1,-1) 

sage: W._test_codegrees() 

Traceback (most recent call last): 

... 

AssertionError: the codegrees should be nonnegative 

 

We restore W to its normal state:: 

 

sage: del W.codegrees 

sage: W._test_codegrees() 

 

See the documentation for :class:`TestSuite` for more information. 

""" 

from sage.structure.element import parent 

from sage.rings.integer_ring import ZZ 

 

tester = self._tester(**options) 

codegrees = self.codegrees() 

tester.assertIsInstance(codegrees, tuple, 

"the codegrees method should return a tuple") 

tester.assertTrue(all(parent(d) is ZZ for d in codegrees), 

"the codegrees should be integers") 

tester.assertTrue(all(d >= 0 for d in codegrees), 

"the codegrees should be nonnegative") 

tester.assertEqual(len(codegrees), self.rank(), 

"the number of codegrees should coincide with the rank") 

tester.assertEqual(sum(d+1 for d in codegrees), 

self.number_of_reflection_hyperplanes(), 

"the sum of the codegrees should be consistent with the number of reflection hyperplanes") 

 

@cached_method 

def number_of_reflection_hyperplanes(self): 

r""" 

Return the number of reflection hyperplanes of ``self``. 

 

This is also the number of distinguished reflections. For 

real groups, this coincides with the number of 

reflections. 

 

This implementation uses that it is given by the sum of 

the codegrees of ``self`` plus its rank. 

 

.. SEEALSO:: :meth:`number_of_reflections` 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: W.number_of_reflection_hyperplanes() 

3 

sage: W = ColoredPermutations(2,3) 

sage: W.number_of_reflection_hyperplanes() 

9 

sage: W = ColoredPermutations(4,3) 

sage: W.number_of_reflection_hyperplanes() 

15 

sage: W = ReflectionGroup((4,2,3)) # optional - gap3 

sage: W.number_of_reflection_hyperplanes() # optional - gap3 

15 

""" 

from sage.rings.all import ZZ 

return ZZ.sum(codeg+1 for codeg in self.codegrees()) 

 

@cached_method 

def number_of_reflections(self): 

r""" 

Return the number of reflections of ``self``. 

 

For real groups, this coincides with the number of 

reflection hyperplanes. 

 

This implementation uses that it is given by the sum of 

the degrees of ``self`` minus its rank. 

 

.. SEEALSO:: :meth:`number_of_reflection_hyperplanes` 

 

EXAMPLES:: 

 

sage: [SymmetricGroup(i).number_of_reflections() for i in range(int(8))] 

[0, 0, 1, 3, 6, 10, 15, 21] 

 

sage: W = ColoredPermutations(1,3) 

sage: W.number_of_reflections() 

3 

sage: W = ColoredPermutations(2,3) 

sage: W.number_of_reflections() 

9 

sage: W = ColoredPermutations(4,3) 

sage: W.number_of_reflections() 

21 

sage: W = ReflectionGroup((4,2,3)) # optional - gap3 

sage: W.number_of_reflections() # optional - gap3 

15 

""" 

from sage.rings.all import ZZ 

return ZZ.sum(deg-1 for deg in self.degrees()) 

 

@cached_method 

def rank(self): 

r""" 

Return the rank of ``self``. 

 

The rank of ``self`` is the dimension of the smallest 

faithfull reflection representation of ``self``. 

 

This default implementation uses that the rank is the 

number of :meth:`degrees`. 

 

.. SEEALSO:: :meth:`ComplexReflectionGroups.rank` 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: W.rank() 

2 

sage: W = ColoredPermutations(2,3) 

sage: W.rank() 

3 

sage: W = ColoredPermutations(4,3) 

sage: W.rank() 

3 

sage: W = ReflectionGroup((4,2,3)) # optional - gap3 

sage: W.rank() # optional - gap3 

3 

""" 

return len(self.degrees()) 

 

@cached_method 

def cardinality(self): 

r""" 

Return the cardinality of ``self``. 

 

It is given by the product of the degrees of ``self``. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: W.cardinality() 

6 

sage: W = ColoredPermutations(2,3) 

sage: W.cardinality() 

48 

sage: W = ColoredPermutations(4,3) 

sage: W.cardinality() 

384 

sage: W = ReflectionGroup((4,2,3)) # optional - gap3 

sage: W.cardinality() # optional - gap3 

192 

""" 

from sage.rings.all import ZZ 

return ZZ.prod(self.degrees()) 

 

def is_well_generated(self): 

r""" 

Return whether ``self`` is well-generated. 

 

A finite complex reflection group is *well generated* if 

the number of its simple reflections coincides with its rank. 

 

.. SEEALSO:: :meth:`ComplexReflectionGroups.Finite.WellGenerated` 

 

.. NOTE:: 

 

- All finite real reflection groups are well generated. 

- The complex reflection groups of type `G(r,1,n)` and 

of type `G(r,r,n)` are well generated. 

- The complex reflection groups of type `G(r,p,n)` 

with `1 < p < r` are *not* well generated. 

 

- The direct product of two well generated finite 

complex reflection group is still well generated. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: W.is_well_generated() 

True 

 

sage: W = ColoredPermutations(4,3) 

sage: W.is_well_generated() 

True 

 

sage: W = ReflectionGroup((4,2,3)) # optional - gap3 

sage: W.is_well_generated() # optional - gap3 

False 

 

sage: W = ReflectionGroup((4,4,3)) # optional - gap3 

sage: W.is_well_generated() # optional - gap3 

True 

""" 

return self.number_of_simple_reflections() == self.rank() 

 

def is_real(self): 

r""" 

Return whether ``self`` is real. 

 

A complex reflection group is *real* if it is isomorphic 

to a reflection group in `GL(V)` over a real vector space `V`. 

Equivalently its character table has real entries. 

 

This implementation uses the following statement: an 

irreducible complex reflection group is real if and only 

if `2` is a degree of ``self`` with multiplicity one. 

Hence, in general we just need to compare the number of 

occurrences of `2` as degree of ``self`` and the number of 

irreducible components. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: W.is_real() 

True 

 

sage: W = ColoredPermutations(4,3) 

sage: W.is_real() 

False 

 

.. TODO:: 

 

Add an example of non real finite complex reflection 

group that is generated by order 2 reflections. 

""" 

return self.degrees().count(2) == self.number_of_irreducible_components() 

 

@cached_method 

def base_change_matrix(self): 

r""" 

Return the base change from the standard basis of the vector 

space of ``self`` to the basis given by the independent roots of 

``self``. 

 

.. TODO:: 

 

For non-well-generated groups there is a conflict with 

construction of the matrix for an element. 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

sage: W.base_change_matrix() # optional - gap3 

[1 0] 

[0 1] 

 

sage: W = ReflectionGroup(23) # optional - gap3 

sage: W.base_change_matrix() # optional - gap3 

[1 0 0] 

[0 1 0] 

[0 0 1] 

 

sage: W = ReflectionGroup((3,1,2)) # optional - gap3 

sage: W.base_change_matrix() # optional - gap3 

[1 0] 

[1 1] 

 

sage: W = ReflectionGroup((4,2,2)) # optional - gap3 

sage: W.base_change_matrix() # optional - gap3 

[ 1 0] 

[E(4) 1] 

""" 

from sage.matrix.all import Matrix 

return Matrix( list(self.independent_roots()) ).inverse() 

 

class ElementMethods: 

 

@abstract_method(optional=True) 

def to_matrix(self): 

r""" 

Return the matrix presentation of ``self`` acting on a 

vector space `V`. 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

sage: [t.to_matrix() for t in W] # optional - gap3 

[ 

[1 0] [ 1 1] [-1 0] [-1 -1] [ 0 1] [ 0 -1] 

[0 1], [ 0 -1], [ 1 1], [ 1 0], [-1 -1], [-1 0] 

] 

 

sage: W = ColoredPermutations(1,3) 

sage: [t.to_matrix() for t in W] 

[ 

[1 0 0] [1 0 0] [0 1 0] [0 0 1] [0 1 0] [0 0 1] 

[0 1 0] [0 0 1] [1 0 0] [1 0 0] [0 0 1] [0 1 0] 

[0 0 1], [0 1 0], [0 0 1], [0 1 0], [1 0 0], [1 0 0] 

] 

 

A different representation is given by the 

colored permutations:: 

 

sage: W = ColoredPermutations(3, 1) 

sage: [t.to_matrix() for t in W] 

[[1], [zeta3], [-zeta3 - 1]] 

""" 

 

def _matrix_(self): 

""" 

Return ``self`` as a matrix. 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

sage: [matrix(t) for t in W] # optional - gap3 

[ 

[1 0] [ 1 1] [-1 0] [-1 -1] [ 0 1] [ 0 -1] 

[0 1], [ 0 -1], [ 1 1], [ 1 0], [-1 -1], [-1 0] 

] 

""" 

return self.to_matrix() 

 

def character_value(self): 

r""" 

Return the value at ``self`` of the character of the 

reflection representation given by :meth:`to_matrix`. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3); W 

1-colored permutations of size 3 

sage: [t.character_value() for t in W] 

[3, 1, 1, 0, 0, 1] 

 

Note that this could be a different (faithful) 

representation than that given by the corresponding root 

system:: 

 

sage: W = ReflectionGroup((1,1,3)); W # optional - gap3 

Irreducible real reflection group of rank 2 and type A2 

sage: [t.character_value() for t in W] # optional - gap3 

[2, 0, 0, -1, -1, 0] 

 

sage: W = ColoredPermutations(2,2); W 

2-colored permutations of size 2 

sage: [t.character_value() for t in W] 

[2, 0, 0, -2, 0, 0, 0, 0] 

 

sage: W = ColoredPermutations(3,1); W 

3-colored permutations of size 1 

sage: [t.character_value() for t in W] 

[1, zeta3, -zeta3 - 1] 

""" 

return self.to_matrix().trace() 

 

#@cached_in_parent_method 

def reflection_length(self, in_unitary_group=False): 

r""" 

Return the reflection length of ``self``. 

 

This is the minimal numbers of reflections needed to 

obtain ``self``. 

 

INPUT: 

 

- ``in_unitary_group`` -- (default: ``False``) if ``True``, 

the reflection length is computed in the unitary group 

which is the dimension of the move space of ``self`` 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

sage: sorted([t.reflection_length() for t in W]) # optional - gap3 

[0, 1, 1, 1, 2, 2] 

 

sage: W = ReflectionGroup((2,1,2)) # optional - gap3 

sage: sorted([t.reflection_length() for t in W]) # optional - gap3 

[0, 1, 1, 1, 1, 2, 2, 2] 

 

sage: W = ReflectionGroup((2,2,2)) # optional - gap3 

sage: sorted([t.reflection_length() for t in W]) # optional - gap3 

[0, 1, 1, 2] 

 

sage: W = ReflectionGroup((3,1,2)) # optional - gap3 

sage: sorted([t.reflection_length() for t in W]) # optional - gap3 

[0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] 

""" 

W = self.parent() 

if in_unitary_group or W.is_real(): 

from sage.matrix.special import identity_matrix 

I = identity_matrix(self.parent().rank()) 

return W.rank() - (self.canonical_matrix() - I).right_nullity() 

else: 

return len(self.reduced_word_in_reflections()) 

 

class Irreducible(CategoryWithAxiom): 

 

def example(self): 

r""" 

Return an example of an irreducible complex reflection group. 

 

EXAMPLES:: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: ComplexReflectionGroups().Finite().Irreducible().example() # optional - gap3 

Irreducible complex reflection group of rank 3 and type G(4,2,3) 

""" 

from sage.combinat.root_system.reflection_group_real import ReflectionGroup 

return ReflectionGroup((4,2,3)) 

 

class ParentMethods: 

def coxeter_number(self): 

r""" 

Return the Coxeter number of an irreducible 

reflection group. 

 

This is defined as `\frac{N + N^*}{n}` where 

`N` is the number of reflections, `N^*` is the 

number of reflection hyperplanes, and `n` is the 

rank of ``self``. 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup(31) # optional - gap3 

sage: W.coxeter_number() # optional - gap3 

30 

""" 

return (self.number_of_reflection_hyperplanes() 

+ self.number_of_reflections()) // self.rank() 

 

def elements_below_coxeter_element(self, c=None): 

r""" 

Return all elements in ``self`` in the interval `[1,c]` in the 

absolute order of ``self``. 

 

This order is defined by 

 

.. MATH:: 

 

\omega \leq_R \tau \Leftrightarrow \ell_R(\omega) + 

\ell_R(\omega^{-1} \tau) = \ell_R(\tau), 

 

where `\ell_R` denotes the reflection length. 

 

.. NOTE:: 

 

``self`` is assumed to be well-generated. 

 

INPUT: 

 

- ``c`` -- (default: ``None``) if an element ``c`` is given, it 

is used as the maximal element in the interval; if a list is 

given, the union of the various maximal elements is computed 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

 

sage: sorted( w.reduced_word() for w in W.elements_below_coxeter_element() ) # optional - gap3 

[[], [1], [1, 2], [1, 2, 1], [2]] 

 

sage: sorted( w.reduced_word() for w in W.elements_below_coxeter_element(W.from_reduced_word([2,1])) ) # optional - gap3 

[[], [1], [1, 2, 1], [2], [2, 1]] 

 

sage: sorted( w.reduced_word() for w in W.elements_below_coxeter_element(W.from_reduced_word([2])) ) # optional - gap3 

[[], [2]] 

""" 

if c in self: 

cs = [c] 

elif c is None: 

cs = [self.coxeter_element()] 

else: 

cs = list(c) 

l = cs[0].reflection_length(in_unitary_group=True) 

f = lambda pi: any(pi.reflection_length(in_unitary_group=True) 

+ (c*pi**-1).reflection_length(in_unitary_group=True) == l 

for c in cs) 

# first computing the conjugacy classes only needed if the 

# interaction with gap3 is slow due to a bug 

#self.conjugacy_classes() 

return filter(f, self) 

 

# TODO: have a cached and an uncached version 

@cached_method 

def noncrossing_partition_lattice(self, c=None, L=None, in_unitary_group=False): 

r""" 

Return the interval `[1,c]` in the absolute order of 

``self`` as a finite lattice. 

 

.. SEEALSO:: :meth:`elements_below_coxeter_element` 

 

INPUT: 

 

- ``c`` -- (default: ``None``) if an element ``c`` in ``self`` is 

given, it is used as the maximal element in the interval 

 

- ``L`` -- (default: ``None``) if a subset ``L`` (must be hashable!) 

of ``self`` is given, it is used as the underlying set (only 

cover relations are checked) 

 

- ``in_unitary_group`` -- (default: ``False``) if ``False``, the 

relation is given by `\sigma \leq \tau` if 

`l_R(\sigma) + l_R(\sigma^{-1}\tau) = l_R(\tau)`; 

if ``True``, the relation is given by `\sigma \leq \tau` if 

`\dim(\mathrm{Fix}(\sigma)) + \dim(\mathrm{Fix}(\sigma^{-1}\tau)) 

= \dim(\mathrm{Fix}(\tau))` 

 

EXAMPLES:: 

 

sage: W = WeylGroup(['G', 2]) 

sage: W.noncrossing_partition_lattice() 

Finite lattice containing 8 elements 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

 

sage: sorted( w.reduced_word() for w in W.noncrossing_partition_lattice() ) # optional - gap3 

[[], [1], [1, 2], [1, 2, 1], [2]] 

 

sage: sorted( w.reduced_word() for w in W.noncrossing_partition_lattice(W.from_reduced_word([2,1])) ) # optional - gap3 

[[], [1], [1, 2, 1], [2], [2, 1]] 

 

sage: sorted( w.reduced_word() for w in W.noncrossing_partition_lattice(W.from_reduced_word([2])) ) # optional - gap3 

[[], [2]] 

""" 

from sage.combinat.posets.all import Poset, LatticePoset 

if c is None: 

c = self.coxeter_element() 

 

smart_covers = not in_unitary_group 

 

if self.is_real(): 

smart_covers = in_unitary_group = True 

 

R = self.reflections() 

if L is None: 

L = self.elements_below_coxeter_element(c=c) 

try: 

if c.is_coxeter_element(): 

smart_covers = in_unitary_group = True 

except AttributeError: 

pass 

rels = [] 

ref_lens = {w: w.reflection_length(in_unitary_group=in_unitary_group) 

for w in L} 

if smart_covers: 

for pi in L: 

for t in R: 

tau = pi*t 

if tau in L and ref_lens[pi] + 1 == ref_lens[tau]: 

rels.append((pi,tau)) 

else: 

rels = [(pi,tau) for pi in L for tau in L 

if ref_lens[pi] + ref_lens[pi.inverse()*tau] == ref_lens[tau]] 

P = Poset((L,rels), cover_relations=smart_covers, facade=True) 

if P.is_lattice(): 

return LatticePoset(P) 

else: 

return P 

 

def generalized_noncrossing_partitions(self, m, c=None, positive=False): 

r""" 

Return the set of all chains of length ``m`` in the 

noncrossing partition lattice of ``self``, see 

:meth:`noncrossing_partition_lattice`. 

 

.. NOTE:: 

 

``self`` is assumed to be well-generated. 

 

INPUT: 

 

- ``c`` -- (default: ``None``) if an element ``c`` in ``self`` 

is given, it is used as the maximal element in the interval 

 

- ``positive`` -- (default: ``False``) if ``True``, only those 

generalized noncrossing partitions of full support are returned 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

 

sage: sorted([w.reduced_word() for w in chain] # optional - gap3 

....: for chain in W.generalized_noncrossing_partitions(2)) # optional - gap3 

[[[], [], [1, 2]], 

[[], [1], [2]], 

[[], [1, 2], []], 

[[], [1, 2, 1], [1]], 

[[], [2], [1, 2, 1]], 

[[1], [], [2]], 

[[1], [2], []], 

[[1, 2], [], []], 

[[1, 2, 1], [], [1]], 

[[1, 2, 1], [1], []], 

[[2], [], [1, 2, 1]], 

[[2], [1, 2, 1], []]] 

 

sage: sorted([w.reduced_word() for w in chain] # optional - gap3 

....: for chain in W.generalized_noncrossing_partitions(2, positive=True)) # optional - gap3 

[[[], [1, 2], []], 

[[], [1, 2, 1], [1]], 

[[1], [2], []], 

[[1, 2], [], []], 

[[1, 2, 1], [], [1]], 

[[1, 2, 1], [1], []], 

[[2], [1, 2, 1], []]] 

""" 

from sage.combinat.combination import Combinations 

NC = self.noncrossing_partition_lattice(c=c) 

one = self.one() 

if c is None: 

c = self.coxeter_element() 

chains = NC.chains() 

NCm = set() 

iter = chains.breadth_first_search_iterator() 

chain = next(iter) 

chain = next(iter) 

while len(chain) <= m: 

chain.append(c) 

for i in range(len(chain)-1, 0, -1): 

chain[i] = chain[i-1]**-1 * chain[i] 

k = m + 1 - len(chain) 

for positions in Combinations(range(m+1),k): 

ncm = [] 

for l in range(m+1): 

if l in positions: 

ncm.append(one) 

else: 

l_prime = l - len([i for i in positions if i <= l]) 

ncm.append(chain[l_prime]) 

if not positive or prod(ncm[:-1]).has_full_support(): 

NCm.add(tuple(ncm)) 

try: 

chain = next(iter) 

except StopIteration: 

chain = list(range(m + 1)) 

return NCm 

 

# TODO: have a cached and an uncached version 

def absolute_poset(self, in_unitary_group=False): 

r""" 

Return the poset induced by the absolute order of ``self`` 

as a finite lattice. 

 

INPUT: 

 

- ``in_unitary_group`` -- (default: ``False``) if ``False``, 

the relation is given by ``\sigma \leq \tau`` if 

`l_R(\sigma) + l_R(\sigma^{-1}\tau) = l_R(\tau)` 

If ``True``, the relation is given by `\sigma \leq \tau` if 

`\dim(\mathrm{Fix}(\sigma)) + \dim(\mathrm{Fix}(\sigma^{-1}\tau)) 

= \dim(\mathrm{Fix}(\tau))` 

 

.. SEEALSO:: :meth:`noncrossing_partition_lattice` 

 

EXAMPLES:: 

 

sage: P = ReflectionGroup((1,1,3)).absolute_poset(); P # optional - gap3 

Finite poset containing 6 elements 

 

sage: sorted(w.reduced_word() for w in P) # optional - gap3 

[[], [1], [1, 2], [1, 2, 1], [2], [2, 1]] 

 

sage: W = ReflectionGroup(4); W # optional - gap3 

Irreducible complex reflection group of rank 2 and type ST4 

sage: W.absolute_poset() # optional - gap3 

Finite poset containing 24 elements 

""" 

return self.noncrossing_partition_lattice(L=self, in_unitary_group=in_unitary_group) 

 

class WellGenerated(CategoryWithAxiom): 

 

def example(self): 

r""" 

Return an example of a well-generated complex reflection group. 

 

EXAMPLES:: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: ComplexReflectionGroups().Finite().WellGenerated().example() # optional - gap3 

Reducible complex reflection group of rank 4 and type A2 x G(3,1,2) 

""" 

from sage.combinat.root_system.reflection_group_real import ReflectionGroup 

return ReflectionGroup((1,1,3), (3,1,2)) 

 

class ParentMethods: 

def _test_well_generated(self, **options): 

""" 

Check if ``self`` is well-generated. 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((3,1,2)) # optional - gap3 

sage: W._test_well_generated() # optional - gap3 

""" 

tester = self._tester(**options) 

tester.assertEqual(self.number_of_simple_reflections(), self.rank()) 

 

def is_well_generated(self): 

r""" 

Return ``True`` as ``self`` is well-generated. 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((3,1,2)) # optional - gap3 

sage: W.is_well_generated() # optional - gap3 

True 

""" 

return True 

 

coxeter_element = CoxeterGroups.ParentMethods.coxeter_element 

standard_coxeter_elements = CoxeterGroups.ParentMethods.standard_coxeter_elements 

 

@cached_method 

def coxeter_elements(self): 

r""" 

Return the (unique) conjugacy class in ``self`` containing all 

Coxeter elements. 

 

A Coxeter element is an element that has an eigenvalue 

`e^{2\pi i/h}` where `h` is the Coxeter number. 

 

In case of finite Coxeter groups, these are exactly the 

elements that are conjugate to one (or, equivalently, 

all) standard Coxeter element, this is, to an element 

that is the product of the simple generators in some 

order. 

 

.. SEEALSO:: :meth:`~sage.categories.coxeter_groups.standard_coxeter_elements` 

 

EXAMPLES:: 

 

sage: W = ReflectionGroup((1,1,3)) # optional - gap3 

sage: sorted(c.reduced_word() for c in W.coxeter_elements()) # optional - gap3 

[[1, 2], [2, 1]] 

 

sage: W = ReflectionGroup((1,1,4)) # optional - gap3 

sage: sorted(c.reduced_word() for c in W.coxeter_elements()) # optional - gap3 

[[1, 2, 1, 3, 2], [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 1, 3, 2, 1], [3, 2, 1]] 

""" 

return self.coxeter_element().conjugacy_class() 

 

class Irreducible(CategoryWithAxiom): 

r""" 

The category of finite irreducible well-generated 

finite complex reflection groups. 

""" 

def example(self): 

r""" 

Return an example of an irreducible well-generated 

complex reflection group. 

 

EXAMPLES:: 

 

sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

sage: ComplexReflectionGroups().Finite().WellGenerated().Irreducible().example() 

4-colored permutations of size 3 

""" 

from sage.combinat.colored_permutations import ColoredPermutations 

return ColoredPermutations(4, 3) 

 

class ParentMethods: 

def coxeter_number(self): 

r""" 

Return the Coxeter number of a well-generated, 

irreducible reflection group. This is defined to be 

the order of a regular element in ``self``, and is 

equal to the highest degree of ``self``. 

 

.. SEEALSO:: :meth:`ComplexReflectionGroups.Finite.Irreducible` 

 

.. NOTE:: 

 

This method overwrites the more general 

method for complex reflection groups since 

the expression given here is quicker to 

compute. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: W.coxeter_number() 

3 

 

sage: W = ColoredPermutations(4,3) 

sage: W.coxeter_number() 

12 

 

sage: W = ReflectionGroup((4,4,3)) # optional - gap3 

sage: W.coxeter_number() # optional - gap3 

8 

""" 

return max(self.degrees()) 

 

def number_of_reflections_of_full_support(self): 

r""" 

Return the number of reflections with full 

support. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,4) 

sage: W.number_of_reflections_of_full_support() 

1 

 

sage: W = ColoredPermutations(3,3) 

sage: W.number_of_reflections_of_full_support() 

3 

""" 

n = self.rank() 

h = self.coxeter_number() 

l = self.cardinality() 

codegrees = self.codegrees()[:-1] 

return (n * h * prod(codegrees)) // l 

 

@cached_method 

def rational_catalan_number(self, p, polynomial=False): 

r""" 

Return the ``p``-th rational Catalan number 

associated to ``self``. 

 

It is defined by 

 

.. MATH:: 

 

\prod_{i = 1}^n \frac{p + (p(d_i-1)) \mod h)}{d_i}, 

 

where `d_1, \ldots, d_n` are the degrees and 

`h` is the Coxeter number. See [STW2016]_ 

for this formula. 

 

INPUT: 

 

- ``polynomial`` -- optional boolean (default ``False``) 

if ``True``, return instead the `q`-analogue as a 

polynomial in `q` 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: [W.rational_catalan_number(p) for p in [5,7,8]] 

[7, 12, 15] 

 

sage: W = ColoredPermutations(2,2) 

sage: [W.rational_catalan_number(p) for p in [7,9,11]] 

[10, 15, 21] 

 

TESTS:: 

 

sage: W = ColoredPermutations(1,4) 

sage: W.rational_catalan_number(3, polynomial=True) 

q^6 + q^4 + q^3 + q^2 + 1 

""" 

from sage.arith.all import gcd 

from sage.combinat.q_analogues import q_int 

 

h = self.coxeter_number() 

if not gcd(h,p) == 1: 

raise ValueError("parameter p = %s is not coprime to the Coxeter number %s" % (p, h)) 

 

if polynomial: 

f = q_int 

else: 

f = lambda n: n 

 

num = prod(f(p + (p * (deg - 1)) % h) 

for deg in self.degrees()) 

den = prod(f(deg) for deg in self.degrees()) 

return num // den 

 

def fuss_catalan_number(self, m, positive=False, 

polynomial=False): 

r""" 

Return the ``m``-th Fuss-Catalan number 

associated to ``self``. 

 

This is defined by 

 

.. MATH:: 

 

\prod_{i = 1}^n \frac{d_i + mh}{d_i}, 

 

where `d_1, \ldots, d_n` are the degrees and 

`h` is the Coxeter number. 

 

INPUT: 

 

- ``positive`` -- optional boolean (default ``False``) 

if ``True``, return instead the positive Fuss-Catalan 

number 

- ``polynomial`` -- optional boolean (default ``False``) 

if ``True``, return instead the `q`-analogue as a 

polynomial in `q` 

 

See [Ar2006]_ for further information. 

 

.. NOTE:: 

 

- For the symmetric group `S_n`, it reduces to the 

Fuss-Catalan number `\frac{1}{mn+1}\binom{(m+1)n}{n}`. 

- The Fuss-Catalan numbers for `G(r, 1, n)` all 

coincide for `r > 1`. 

 

EXAMPLES:: 

 

sage: W = ColoredPermutations(1,3) 

sage: [W.fuss_catalan_number(i) for i in [1,2,3]] 

[5, 12, 22] 

 

sage: W = ColoredPermutations(1,4) 

sage: [W.fuss_catalan_number(i) for i in [1,2,3]] 

[14, 55, 140] 

 

sage: W = ColoredPermutations(1,5) 

sage: [W.fuss_catalan_number(i) for i in [1,2,3]] 

[42, 273, 969] 

 

sage: W = ColoredPermutations(2,2) 

sage: [W.fuss_catalan_number(i) for i in [1,2,3]] 

[6, 15, 28] 

 

sage: W = ColoredPermutations(2,3) 

sage: [W.fuss_catalan_number(i) for i in [1,2,3]] 

[20, 84, 220] 

 

sage: W = ColoredPermutations(2,4) 

sage: [W.fuss_catalan_number(i) for i in [1,2,3]] 

[70, 495, 1820] 

 

TESTS:: 

 

sage: W = ColoredPermutations(2,4) 

sage: W.fuss_catalan_number(2,positive=True) 

330 

sage: W = ColoredPermutations(2,2) 

sage: W.fuss_catalan_number(2,polynomial=True) 

q^16 + q^14 + 2*q^12 + 2*q^10 + 3*q^8 + 2*q^6 + 

2*q^4 + q^2 + 1 

""" 

h = self.coxeter_number() 

if positive: 

p = m * h - 1 

else: 

p = m * h + 1 

 

return self.rational_catalan_number(p, polynomial=polynomial) 

 

def catalan_number(self, positive=False, polynomial=False): 

r""" 

Return the Catalan number associated to ``self``. 

 

It is defined by 

 

.. MATH:: 

 

\prod_{i = 1}^n \frac{d_i + h}{d_i}, 

 

where `d_1, \ldots, d_n` are the degrees and where 

`h` is the Coxeter number. 

See [Ar2006]_ for further information. 

 

INPUT: 

 

- ``positive`` -- optional boolean (default ``False``) 

if ``True``, return instead the positive Catalan 

number 

- ``polynomial`` -- optional boolean (default ``False``) 

if ``True``, return instead the `q`-analogue as a 

polynomial in `q` 

 

.. NOTE:: 

 

- For the symmetric group `S_n`, it reduces to the 

Catalan number `\frac{1}{n+1} \binom{2n}{n}`. 

- The Catalan numbers for `G(r,1,n)` all coincide 

for `r > 1`. 

 

EXAMPLES:: 

 

sage: [ColoredPermutations(1,n).catalan_number() for n in [3,4,5]] 

[5, 14, 42] 

 

sage: [ColoredPermutations(2,n).catalan_number() for n in [3,4,5]] 

[20, 70, 252] 

 

sage: [ReflectionGroup((2,2,n)).catalan_number() for n in [3,4,5]] # optional - gap3 

[14, 50, 182] 

 

TESTS:: 

 

sage: W = ColoredPermutations(3,6) 

sage: W.catalan_number(positive=True) 

462 

sage: W = ColoredPermutations(2,2) 

sage: W.catalan_number(polynomial=True) 

q^8 + q^6 + 2*q^4 + q^2 + 1 

""" 

return self.fuss_catalan_number(1, positive=positive, 

polynomial=polynomial)