saving . . . saved Command error - shown as matrix instead of asmatrix has been deleted. Command error - shown as matrix instead of asmatrix has been hidden .
Command error - shown as matrix instead of asmatrix
Title
Question
\r\n\r\n\r\n\r\n\r\n<style type="text/css">\r\np.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #34a327; background-color: #ffffff}\r\np.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}\r\np.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}\r\np.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c33720; background-color: #ffffff}\r\np.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #34bc26; background-color: #ffffff}\r\np.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #5230e1; background-color: #ffffff}\r\nspan.s1 {font-variant-ligatures: no-common-ligatures}\r\nspan.s2 {font-variant-ligatures: no-common-ligatures; color: #2ee721}\r\nspan.s3 {font-variant-ligatures: no-common-ligatures; color: #000000}\r\nspan.s4 {font-variant-ligatures: no-common-ligatures; color: #3c9ff2}\r\nspan.s5 {font-variant-ligatures: no-common-ligatures; color: #34a327}\r\nspan.s6 {font-variant-ligatures: no-common-ligatures; color: #c33720}\r\nspan.s7 {font-variant-ligatures: no-common-ligatures; color: #33bbc8}\r\nspan.s8 {font-variant-ligatures: no-common-ligatures; color: #5230e1}\r\nspan.s9 {font-variant-ligatures: no-common-ligatures; color: #34bc26}\r\n</style>\r\n\r\n\r\n

<span class="s1">In [</span><span class="s2">110</span><span class="s1">]: from</span><span class="s3"> </span><span class="s4">numpy.linalg</span><span class="s3"> </span><span class="s1">import</span><span class="s3"> det</span>

\r\n

<span class="s1"></span>

\r\n

<span class="s5">In [</span><span class="s2">111</span><span class="s5">]: </span><span class="s1">m5 = matrix([[</span><span class="s5">2</span><span class="s1">,-</span><span class="s5">3</span><span class="s1">,</span><span class="s5">1</span><span class="s1">],[</span><span class="s5">2</span><span class="s1">,</span><span class="s5">0</span><span class="s1">,-</span><span class="s5">1</span><span class="s1">],[</span><span class="s5">1</span><span class="s1">,</span><span class="s5">4</span><span class="s1">,</span><span class="s5">5</span><span class="s1">]])</span>

\r\n

<span class="s1">---------------------------------------------------------------------------</span>

\r\n

<span class="s6">NameError</span><span class="s1"> <span class="Apple-converted-space">                                </span>Traceback (most recent call last)</span>

\r\n

<span class="s1"><ipython-input-111-8f370b341908></span><span class="s3"> in </span><span class="s7"><module></span><span class="s8">()</span>

\r\n

<span class="s9">----> 1</span><span class="s6"> </span><span class="s3">m5 </span><span class="s1">=</span><span class="s3"> matrix</span><span class="s1">([[</span><span class="s7">2</span><span class="s1">,-</span><span class="s7">3</span><span class="s1">,</span><span class="s7">1</span><span class="s1">],[</span><span class="s7">2</span><span class="s1">,</span><span class="s7">0</span><span class="s1">,-</span><span class="s7">1</span><span class="s1">],[</span><span class="s7">1</span><span class="s1">,</span><span class="s7">4</span><span class="s1">,</span><span class="s7">5</span><span class="s1">]])</span>

\r\n

<span class="s1"></span>

\r\n

<span class="s6">NameError</span><span class="s1">: name 'matrix' is not defined</span>

<span class="s1">
</span>

<span class="s1">Solution - if matrix is replaced with asmatrix it works fine.</span>


Python Matrices 06-07 min 30-40 sec 25-05-19, 4:21 p.m. erankikiran

Answers:

matrix should work.
Kindly confirm that you have done from numpy import matrix
25-05-19, 4:35 p.m. pratham920


Log-in to answer to this question.