Ejemplo n.º 1
0
 public function test_matrix_eigenvalues()
 {
     $cs = array('A:matrix([7,1,3],[5,-3,4],[5,3,-4])', 'E:first(eigenvalues(A))', 'dt:determinant(A)');
     foreach ($cs as $s) {
         $s1[] = new stack_cas_casstring($s);
     }
     $options = new stack_options();
     $options->set_option('matrixparens', '(');
     $at1 = new stack_cas_session($s1, $options, 0);
     $this->assertEquals('[1-sqrt(66),sqrt(66)+1,-2]', $at1->get_value_key('E'));
     $this->assertEquals('130', $at1->get_value_key('dt'));
     $this->assertEquals('\\left(\\begin{array}{ccc} 7 & 1 & 3 \\\\ 5 & -3 & 4 \\\\ 5 & 3 & -4 \\end{array}\\right)', $at1->get_display_key('A'));
 }
 public function test_ordergreat()
 {
     $cs = array('ordergreat(i,j,k)', 'p:matrix([-7],[2],[-3])', 'q:matrix([i],[j],[k])', 'v:dotproduct(p,q)');
     foreach ($cs as $s) {
         $cs = new stack_cas_casstring($s);
         $cs->get_valid('t');
         $s1[] = $cs;
     }
     $at1 = new stack_cas_session($s1, null, 0);
     $at1->instantiate();
     // There has been a subtle change to associativity in Maxima 5.37.0.
     $this->assertEquals('-7\\cdot i+2\\cdot j-3\\cdot k', $at1->get_display_key('v'));
 }