|
| 1 | +# sage.doctest: needs sage.graphs sage.modules |
1 | 2 | r""" |
2 | 3 | This file contains doctests of the article :: |
3 | 4 |
|
|
505 | 506 |
|
506 | 507 | Sage example in fsm-in-sage.tex, line 1091:: |
507 | 508 |
|
508 | | - sage: var('y') |
| 509 | + sage: var('y') # needs sage.symbolic |
509 | 510 | y |
510 | 511 | sage: def am_entry(trans): |
511 | 512 | ....: return y^add(trans.word_out) / 2 |
512 | | - sage: A = W.adjacency_matrix(entry=am_entry) |
| 513 | + sage: A = W.adjacency_matrix(entry=am_entry) # needs sage.symbolic |
513 | 514 |
|
514 | 515 |
|
515 | 516 | Sage example in fsm-in-sage.tex, line 1097:: |
|
519 | 520 |
|
520 | 521 | Sage example in fsm-in-sage.tex, line 1099:: |
521 | 522 |
|
522 | | - sage: latex(A) |
| 523 | + sage: latex(A) # needs sage.symbolic |
523 | 524 | \left(\begin{array}{ccccccccc} |
524 | 525 | \frac{1}{2} & \frac{1}{2} \, y^{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ |
525 | 526 | 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 \\ |
|
535 | 536 |
|
536 | 537 | Sage example in fsm-in-sage.tex, line 1109:: |
537 | 538 |
|
538 | | - sage: (pi_not_normalized,) = (A.subs(y=1) - A.parent().identity_matrix())\ |
539 | | - ....: .left_kernel().basis() |
540 | | - sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) |
| 539 | + sage: A1mI = (A.subs(y=1) - A.parent().identity_matrix()) # needs sage.symbolic |
| 540 | + sage: (pi_not_normalized,) = A1mI.left_kernel().basis() # needs sage.symbolic |
| 541 | + sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) # needs sage.symbolic |
541 | 542 |
|
542 | 543 |
|
543 | 544 | Sage example in fsm-in-sage.tex, line 1110:: |
544 | 545 |
|
545 | | - sage: str(pi) |
| 546 | + sage: str(pi) # needs sage.symbolic |
546 | 547 | '(1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9)' |
547 | 548 |
|
548 | 549 |
|
549 | 550 | Sage example in fsm-in-sage.tex, line 1117:: |
550 | 551 |
|
551 | | - sage: expected_output = derivative(A, y).subs(y=1) * vector(len(W.states())*[1]) |
| 552 | + sage: expected_output = derivative(A, y).subs(y=1) * vector(len(W.states())*[1]) # needs sage.symbolic |
552 | 553 |
|
553 | 554 |
|
554 | 555 | Sage example in fsm-in-sage.tex, line 1118:: |
555 | 556 |
|
556 | | - sage: latex(expected_output) |
| 557 | + sage: latex(expected_output) # needs sage.symbolic |
557 | 558 | \left(1,\,0,\,0,\,0,\,\frac{1}{2},\,1,\,1,\,\frac{1}{2},\,1\right) |
558 | 559 |
|
559 | 560 |
|
560 | 561 | Sage example in fsm-in-sage.tex, line 1126:: |
561 | 562 |
|
562 | | - sage: pi * expected_output |
| 563 | + sage: pi * expected_output # needs sage.symbolic |
563 | 564 | 5/9 |
564 | 565 |
|
565 | 566 |
|
566 | 567 | Sage example in fsm-in-sage.tex, line 1127:: |
567 | 568 |
|
568 | | - sage: latex(pi * expected_output) |
| 569 | + sage: latex(pi * expected_output) # needs sage.symbolic |
569 | 570 | \frac{5}{9} |
570 | 571 |
|
571 | 572 |
|
572 | 573 | Sage example in fsm-in-sage.tex, line 1129:: |
573 | 574 |
|
574 | | - sage: latex(pi * expected_output) |
| 575 | + sage: latex(pi * expected_output) # needs sage.symbolic |
575 | 576 | \frac{5}{9} |
576 | 577 |
|
577 | 578 |
|
578 | 579 | Sage example in fsm-in-sage.tex, line 1145:: |
579 | 580 |
|
580 | | - sage: var('k') |
| 581 | + sage: var('k') # needs sage.symbolic |
581 | 582 | k |
582 | | - sage: moments = W.asymptotic_moments(k) |
| 583 | + sage: moments = W.asymptotic_moments(k) # needs sage.symbolic |
583 | 584 |
|
584 | 585 |
|
585 | 586 | Sage example in fsm-in-sage.tex, line 1155:: |
586 | 587 |
|
587 | | - sage: latex(moments['expectation']) |
| 588 | + sage: latex(moments['expectation']) # needs sage.symbolic |
588 | 589 | \frac{5}{9} \, k + \mathcal{O}\left(1\right) |
589 | 590 |
|
590 | 591 |
|
591 | 592 | Sage example in fsm-in-sage.tex, line 1162:: |
592 | 593 |
|
593 | | - sage: latex(moments['variance']) |
| 594 | + sage: latex(moments['variance']) # needs sage.symbolic |
594 | 595 | \frac{44}{243} \, k + \mathcal{O}\left(1\right) |
595 | 596 |
|
596 | 597 |
|
597 | 598 | Sage example in fsm-in-sage.tex, line 1192:: |
598 | 599 |
|
599 | | - sage: expectation_binary = Id.asymptotic_moments(k)['expectation'] |
| 600 | + sage: expectation_binary = Id.asymptotic_moments(k)['expectation'] # needs sage.symbolic |
600 | 601 |
|
601 | 602 |
|
602 | 603 | Sage example in fsm-in-sage.tex, line 1195:: |
603 | 604 |
|
604 | | - sage: latex(expectation_binary) |
| 605 | + sage: latex(expectation_binary) # needs sage.symbolic |
605 | 606 | \frac{1}{2} \, k + \mathcal{O}\left(1\right) |
606 | 607 |
|
607 | 608 |
|
608 | 609 | Sage example in fsm-in-sage.tex, line 1202:: |
609 | 610 |
|
610 | | - sage: expectation_NAF = Weight(NAF).asymptotic_moments(k)['expectation'] |
| 611 | + sage: expectation_NAF = Weight(NAF).asymptotic_moments(k)['expectation'] # needs sage.symbolic |
611 | 612 |
|
612 | 613 |
|
613 | 614 | Sage example in fsm-in-sage.tex, line 1205:: |
614 | 615 |
|
615 | | - sage: latex(expectation_NAF) |
| 616 | + sage: latex(expectation_NAF) # needs sage.symbolic |
616 | 617 | \frac{1}{3} \, k + \mathcal{O}\left(1\right) |
617 | 618 |
|
618 | 619 |
|
619 | 620 | Sage example in fsm-in-sage.tex, line 1211:: |
620 | 621 |
|
621 | | - sage: Abs = transducers.abs([-1, 0, 1]) |
| 622 | + sage: Abs = transducers.abs([-1, 0, 1]) # needs sage.symbolic |
622 | 623 |
|
623 | 624 |
|
624 | 625 | Sage example in fsm-in-sage.tex, line 1216:: |
625 | 626 |
|
626 | | - sage: latex(moments['expectation']) |
| 627 | + sage: latex(moments['expectation']) # needs sage.symbolic |
627 | 628 | \frac{5}{9} \, k + \mathcal{O}\left(1\right) |
628 | 629 |
|
629 | 630 | """ |
0 commit comments