ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 18 Jul 2020 19:37:19 +0200List Object not Callablehttps://ask.sagemath.org/question/52552/list-object-not-callable/ [link text](https://imgur.com/a/oGlsdV8)
Hello, see the link given above. Apparently, I need 60 points to upload images. So the idea is I am trying to construct a matrix by appending lists to each row. I am not understanding the error I am receiving.
CoefficientwList is just a list of numbers. From the second picture, you can see that Separation4 maps a list to a list of lists. By typing Separation4(CoefficientwList)[i1], I am extracting the i1th list in the list of lists. I then apply the vector function to make this list a vector and then from the 3rd picture, you see I add it to a row of the matrix M. Is there anything wrong here?
If more info is needed, please tell me but I am not seeing what the issue is. Sat, 18 Jul 2020 00:49:29 +0200https://ask.sagemath.org/question/52552/list-object-not-callable/Answer by jaydfox for <p><a href="https://imgur.com/a/oGlsdV8">link text</a></p>
<p>Hello, see the link given above. Apparently, I need 60 points to upload images. So the idea is I am trying to construct a matrix by appending lists to each row. I am not understanding the error I am receiving. </p>
<p>CoefficientwList is just a list of numbers. From the second picture, you can see that Separation4 maps a list to a list of lists. By typing Separation4(CoefficientwList)[i1], I am extracting the i1th list in the list of lists. I then apply the vector function to make this list a vector and then from the 3rd picture, you see I add it to a row of the matrix M. Is there anything wrong here? </p>
<p>If more info is needed, please tell me but I am not seeing what the issue is. </p>
https://ask.sagemath.org/question/52552/list-object-not-callable/?answer=52553#post-id-52553I can't see all the code, so I'm not sure exactly what's going on. But this particular line looks like a red flag:
for vector in CoefficientsforSpan:
In that loop, you replaced the standard function `vector()` with a new variable `vector`. This wasn't a problem in that loop. However, the next time you tried to call the `vector()` function to build a new vector, it tried to use the previous `vector` variable instead. And that variable was an actual vector, not a function, so the error message you are seeing is just telling you that you can't call it.
Change the name of vector in that loop, and it might fix your problem. You might need to reload the notebook to fix the vector function. I can't seem to find which module it's loaded from, or I'd give you the import command to fix it. (Update: found it: `from sage.modules.free_module_element import vector`)
Edit: I just noticed, even further up in the code, you used `vector` as a variable. You'll need to use a different variable name. The code in question:
vector=NewMatrix.solve_left(Quotient[i])
CoefficientsforSpan.append(vector)Sat, 18 Jul 2020 02:09:41 +0200https://ask.sagemath.org/question/52552/list-object-not-callable/?answer=52553#post-id-52553Comment by whatupmatt for <p>I can't see all the code, so I'm not sure exactly what's going on. But this particular line looks like a red flag:</p>
<pre><code> for vector in CoefficientsforSpan:
</code></pre>
<p>In that loop, you replaced the standard function <code>vector()</code> with a new variable <code>vector</code>. This wasn't a problem in that loop. However, the next time you tried to call the <code>vector()</code> function to build a new vector, it tried to use the previous <code>vector</code> variable instead. And that variable was an actual vector, not a function, so the error message you are seeing is just telling you that you can't call it.</p>
<p>Change the name of vector in that loop, and it might fix your problem. You might need to reload the notebook to fix the vector function. I can't seem to find which module it's loaded from, or I'd give you the import command to fix it. (Update: found it: <code>from sage.modules.free_module_element import vector</code>)</p>
<p>Edit: I just noticed, even further up in the code, you used <code>vector</code> as a variable. You'll need to use a different variable name. The code in question:</p>
<pre><code>vector=NewMatrix.solve_left(Quotient[i])
CoefficientsforSpan.append(vector)
</code></pre>
https://ask.sagemath.org/question/52552/list-object-not-callable/?comment=52556#post-id-52556Yeah, using the vector as a function and as a name was the issue. Thanks!Sat, 18 Jul 2020 19:37:19 +0200https://ask.sagemath.org/question/52552/list-object-not-callable/?comment=52556#post-id-52556