Ticket #6456: 6456-numerical_sage_cvxopt.patch

File 6456-numerical_sage_cvxopt.patch, 2.0 KB (added by schilly, 10 years ago)

trival changes to the cvxopt chapter in the numerical sage tutorial

  • doc/en/numerical_sage/cvxopt.rst

    # HG changeset patch
    # User Harald Schilly <harald.schilly@gmail.com>
    # Date 1269806313 -7200
    # Node ID 8c4bfe376498282b005f4a8a9412cda95929adc3
    # Parent  bda0676f78aa75d66701775b308384c84afb100a
    cvxopt update needs some trivial changes for the doctested examples in the numerical_sage section for cvxopt
    
    diff -r bda0676f78aa -r 8c4bfe376498 doc/en/numerical_sage/cvxopt.rst
    a b  
    5555     [ 1.]
    5656     [ 1.]]
    5757    sage: print(A)
    58     SIZE: (5,5)
    59         (0, 0)  2.0000e+00
    60         (1, 0)  3.0000e+00
    61         (0, 1)  3.0000e+00
    62         (2, 1) -1.0000e+00
    63         (4, 1)  4.0000e+00
    64         (1, 2)  4.0000e+00
    65         (2, 2) -3.0000e+00
    66         (3, 2)  1.0000e+00
    67         (4, 2)  2.0000e+00
    68         (2, 3)  2.0000e+00
    69         (1, 4)  6.0000e+00
    70         (4, 4)  1.0000e+00
     58    [ 2.00e+00  3.00e+00     0         0         0    ]
     59    [ 3.00e+00     0      4.00e+00     0      6.00e+00]
     60    [    0     -1.00e+00 -3.00e+00  2.00e+00     0    ]
     61    [    0         0      1.00e+00     0         0    ]
     62    [    0      4.00e+00  2.00e+00     0      1.00e+00]
    7163    sage: C=m(B)
    7264    sage: umfpack.linsolve(A,C)
    7365    sage: print(C)
    74        5.7895e-01
    75        -5.2632e-02
    76        1.0000e+00
    77        1.9737e+00
    78        -7.8947e-01
     66    [ 5.79e-01]
     67    [-5.26e-02]
     68    [ 1.00e+00]
     69    [ 1.97e+00]
     70    [-7.89e-01]
    7971
    8072Note the solution is stored in :math:`B` afterward. also note the
    8173m(B), this turns our numpy array into a format cvxopt understands.
     
    9587    sage: A=spmatrix([10,3,5,-2,5,2],[0,2,1,2,2,3],[0,0,1,1,2,3])
    9688    sage: P=amd.order(A)
    9789    sage: print(P)
    98     1   
    99     0   
    100     2   
    101     3   
     90    [ 1]
     91    [ 0]
     92    [ 2]
     93    [ 3]
    10294
    10395For a simple linear programming example, if we want to solve
    10496
     
    135127::
    136128
    137129    sage: print sol['x']      # ... below since can get -00 or +00 depending on architecture
    138        1.0000e...00
    139        1.0000e+00
    140 
     130    [ 1.00e+00]
     131    [ 1.00e+00]