Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Creating/Moving file
Post: RE: Creating/Moving file
Hi :)
To answer your first problem. If you want to create a new file you have two options on how to open it in python so that it will be created. Either use "x" if you just want to create it, but also... |
|
ThiefOfTime |
Homework |
3 |
1,450 |
Mar-25-2022, 10:40 AM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
ah ok, i see. the problem is that you are iterating over lists that you alread modified. If I would guess I would say it is this part:
if (rho_final[row][column]==rho[row][column]):
print(... |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-21-2022, 10:02 AM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
Puh, yeah I get your Problem. it works for one dimensional input, so like single values, because it doesn't effect the dimension of the matrix. But adding a vector changes that of course and since one... |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-20-2022, 02:34 PM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
Also there fail on my part, so sorry. I forgot to mention that subs is returning a new matrix. so in order to have it saved in your old variable you would need to do
rho_matrix = rho_matrix.subs(cur_s... |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-20-2022, 12:15 PM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
So sorry, I mistyped it, the method is not called sub but is called subs:
rho_matrix.subs(cur_symbol, m)for example |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-20-2022, 11:42 AM |
|
|
Thread: add Escape charcters in string
Post: RE: add Escape charcters in string
Well if you want to play save and have it for every platform you can do this:
import os
path_sep = os.path.septhen you can create your first path with the system path separators |
|
ThiefOfTime |
General Coding Help |
3 |
1,141 |
Jan-20-2022, 10:59 AM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
If assigning the 3 Dimension of the Matrix is all you want to do then look at my first post in this thread again. You have matrices with symbols, so now you can assign values to those symbols. I would... |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-20-2022, 09:08 AM |
|
|
Thread: Python keeps running the old version of the code
Post: RE: Python keeps running the old version of the c...
To be fair, I never run into that problem myself. And I mean you already solved it yourself, but I would like to give you a bit of context. Also I am quite sure you may run into that again.
So I assum... |
|
ThiefOfTime |
General Coding Help |
2 |
3,647 |
Jan-20-2022, 07:34 AM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
Well it is quite easy, you actually even answered it yourself in the other thread you opened :D
https://python-forum.io/thread-36127.html
sympy.nsimplify should remove the 1.0 from each symbol since i... |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-20-2022, 07:25 AM |
|
|
Thread: Handling pdf files with python.
Post: RE: Handling pdf files with python.
I guess those links might come handy in what you want to do:
https://realpython.com/pdf-python/#how-t...-in-python
https://pythonhosted.org/PyPDF2/PdfFileReader.html
https://stackoverflow.com/question... |
|
ThiefOfTime |
General Coding Help |
1 |
1,219 |
Jan-19-2022, 02:24 PM |
|
|
Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1
Let me get this straight. You got two matrices using the same sympy variables and you want to fill the tables now and assigning every variable a 1x64 matrix. so if matrix_a[0][0] == matrix_b[0][0] the... |
|
ThiefOfTime |
General Coding Help |
18 |
3,200 |
Jan-19-2022, 01:47 PM |
|
|
Thread: nsimplify, make zero the really small numbers in the matrix
Post: RE: nsimplify, make zero the really small numbers ...
That is strange, I tried your versions, with numpy arrays as well as sympy Matrices. Also python in general is converting -0 to 0 except it is a value that is not exactly zero, so like 1.5e-16, but I ... |
|
ThiefOfTime |
General Coding Help |
5 |
1,592 |
Jan-19-2022, 01:26 PM |
|
|
Thread: nsimplify, make zero the really small numbers in the matrix
Post: RE: nsimplify, make zero the really small numbers ...
hey :)
you are definitely on the right track. That is exactly how it is supposed to be done with nsimplify. Unfortunately I was not able to reproduce the problem in Python 3.10
Which version are you u... |
|
ThiefOfTime |
General Coding Help |
5 |
1,592 |
Jan-19-2022, 10:51 AM |
|
|
Thread: Need explanation of one line of code
Post: RE: Need explanation of one line of code
could you show me the original code, maybe I can help you with that :) |
|
ThiefOfTime |
General Coding Help |
6 |
3,410 |
Feb-17-2020, 08:36 PM |
|
|
Thread: Need explanation of one line of code
Post: RE: Need explanation of one line of code
Hi :)
x << y is a binary operator, which symbolises a left shift. To be a more precise, it shifts the value of x by the value of y to the left: if x is 1 it would be 0001 in binary. so if y is 1... |
|
ThiefOfTime |
General Coding Help |
6 |
3,410 |
Feb-17-2020, 03:59 PM |
|
|
Thread: Python time
Post: RE: Python time
since your input can vary a lot but all have in common that you either have the m, s or h part, you could use regex to filter them out.
for example lets say you have following line in your document "1... |
|
ThiefOfTime |
General Coding Help |
1 |
1,301 |
Feb-14-2020, 04:14 PM |
|
|
Thread: Proper Layout of Code Question
Post: RE: Proper Layout of Code Question
In my experience there is no unwritten rule that states that you have to order in a certain way. But there are however some clever tricks to structure your code.
If you would start with object oriente... |
|
ThiefOfTime |
General Coding Help |
2 |
2,149 |
Feb-07-2020, 09:16 PM |
|
|
Thread: Using input function in a Class
Post: RE: Using input function in a Class
Hi :)
The input function returns a string, so when you are asked for the robot and you type "Zero" the value of c would be "Zero", nothing more. So it is not the Object that you created a few lines be... |
|
ThiefOfTime |
General Coding Help |
2 |
2,236 |
Feb-05-2020, 07:03 AM |
|
|
Thread: Function: SyntaxError: invalid syntax
Post: RE: Function: SyntaxError: invalid syntax
I was kind of confused at the beginning because your program has a huge problem which would result in a TypeError not a SyntaxError, took me some moments to see, that you are missing a ) in line 3.
Th... |
|
ThiefOfTime |
General Coding Help |
2 |
2,314 |
Feb-02-2020, 09:25 PM |
|
|
Thread: Saving a mask as a png file in opencv
Post: RE: Saving a mask as a png file in opencv
Why does the imwriting function not work? Are you getting an error message?
You could try and save it as a .jpg just for testing purpose. Do you need it in .png format or lets say image format in gene... |
|
ThiefOfTime |
General Coding Help |
1 |
5,605 |
Jan-31-2020, 09:20 AM |