Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Check if two matrix are equal and of not add the matrix to the list
Post: Check if two matrix are equal and of not add the m...

I have a list which contains may matrices. I called this list as su4_np and it contains more than 500 matrices When I want to add a matrix to the list, I want to check if there is any matrix in the li...
quest General Coding Help 3 909 Jul-04-2023, 12:24 AM
    Thread: Taking Mathematical Expressions from Strings
Post: Taking Mathematical Expressions from Strings

I have bunch of strings like: import re import ast import numpy as np 1/2 + 1/2*i + 1/2*j + 1/2*k 1 + 0*i + 0*j + 0*k 1 + 1*i + 0*j + 0*k etc... I am trying to extract the numbers from these string...
quest General Coding Help 2 757 Jun-30-2023, 01:31 AM
    Thread: scipy fftfreq parameters
Post: scipy fftfreq parameters

I am trying to get the fft of my pulse. My total pulse duration is 1 microsecond and I have 100000 time slot in this pulse. So each interval corresponds 10 picoseconds. I am trying to find my x axis w...
quest Data Science 1 1,272 Apr-14-2023, 12:11 AM
    Thread: Python Regex
Post: RE: Python Regex

(Sep-21-2022, 08:13 PM)deanhystad Wrote: Parentheses have special meaning in regex and must appear in pairs. If you want to include the () characters in the pattern you need to precede with \: \( o...
quest General Coding Help 2 2,473 Sep-22-2022, 03:15 AM
    Thread: Python Regex
Post: Python Regex

I have the following text file: Output:S = 0, X are: (1, 0, 1, 1, 0, 0, )S = 0, Z are: (0, 1, 1, 1, 0, 1, )Data bits measurement:0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, Measured l0: 1, Measured l1: 0 ...
quest General Coding Help 2 2,473 Sep-21-2022, 12:16 PM
    Thread: The formula in the function is not giving the correct value
Post: RE: The formula in the function is not giving the ...

This line a = 1/2*(np.trace(np.matmul(kraus,pauli))) should be a = 1/2*(np.trace(np.matmul(kraus,pauli[0])))
quest General Coding Help 1 1,292 Mar-30-2022, 03:20 AM
    Thread: The formula in the function is not giving the correct value
Post: The formula in the function is not giving the corr...

Here is my function def coefficients(_list,q_number): paulis = list(product([i,x,y,z],repeat=q_number)) spaulis = list(product(['i','x','y','z'],repeat=q_number)) #print(spaulis) resul...
quest General Coding Help 1 1,292 Mar-29-2022, 02:59 PM
    Thread: Change the key value in dictionary
Post: RE: Change the key value in dictionary

Amazing thanks fro the quick answer :)
quest General Coding Help 3 1,489 Mar-25-2022, 04:47 AM
    Thread: Change the key value in dictionary
Post: Change the key value in dictionary

Hello I have this dictionary: {('i', 'i'): (0.4958635668040591+0.033985852749267645j), ('i', 'x'): (-3.713537562982453e-06-2.578284945296621e-07j), ('i', 'y'): (-2.078134606106431e-06-1.50922727852...
quest General Coding Help 3 1,489 Mar-25-2022, 01:42 AM
    Thread: How to trigger for loop after while
Post: RE: How to trigger for loop after while

thanks a lot
quest General Coding Help 2 1,578 Mar-22-2022, 11:34 PM
    Thread: How to trigger for loop after while
Post: How to trigger for loop after while

Hello, This is my code: input_number=3 layer=5 paulis = list(product(['I','X','Y','Z'],repeat=input_number)) a = list(product(['i','x','y','z'],repeat = input_number)) rho_1='rho_1' ...
quest General Coding Help 2 1,578 Mar-21-2022, 06:41 AM
    Thread: Searching in the list
Post: RE: Searching in the list

(Mar-02-2022, 06:47 AM)Gribouillis Wrote: You could use a dictionary from collections import defaultdict d = defaultdict(complex) for c, name, n in mylist: d[name] += c * c print(d)Thank you ve...
quest General Coding Help 4 1,597 Mar-02-2022, 10:30 AM
    Thread: Searching in the list
Post: Searching in the list

Here is my list: mylist=[((-6.952686099999967e-11+1.761756624e-08j), ('z', 'x'), 3), ((5.815437999999992e-11+4.8251177450000006e-09j), ('z', 'y'), 3), ((1.0000000046778146e-10-1.3938548489871208e-07...
quest General Coding Help 4 1,597 Mar-02-2022, 05:56 AM
    Thread: Make the code shorter
Post: Make the code shorter

I have 4 matrix which is shape 2*2 and pi,px,py and pz are my coefficient. and according to the input from the use, I am trying to calculate my matrix and these coefficient with all combinations. pi l...
quest General Coding Help 2 1,568 Feb-18-2022, 03:54 AM
    Thread: Give a number for Variable
Post: Give a number for Variable

I defined symbols via Sympy and I created an array. Then when I want to give a value to the variable, the variable still stay as variable. a, b, c, d = sympy.symbols('a b c d') error_mat=np.array([[a...
quest General Coding Help 2 1,561 Jan-31-2022, 02:16 AM
    Thread: SOlving LInear Equations in Python(Symoy, NUmpy) - Coefficient Problem
Post: RE: SOlving LInear Equations in Python(Symoy, NUmp...

well, the problem is here a,b,c,d are variables which I want to find them but rho00, rho01 rho10, rho11 are the free varibles which will not take a value and I do not know how to give these equations ...
quest General Coding Help 3 1,805 Jan-30-2022, 10:53 PM
    Thread: SOlving LInear Equations in Python(Symoy, NUmpy) - Coefficient Problem
Post: SOlving LInear Equations in Python(Symoy, NUmpy) -...

Hello I am trying to solve set of equations and I actually know the how to solve them but I am having some problems and for some reason I cannot give the coefficients correctly I guess So, Here is my...
quest General Coding Help 3 1,805 Jan-30-2022, 11:50 AM
    Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1

Helloooo :) I solved the problem. It is quite simple: count = 0 rho_final_arr = np.array(rho_final) rho_i_arr=np.array(rho_i) for row in range(8): for column in range(8): if row==0 and c...
quest General Coding Help 18 3,448 Jan-24-2022, 01:07 AM
    Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1

unfortunately, I still have the same error and I do not understand the reason.... here is my new code: count = 0 rho_final_arr = np.array(rho_final) for row in range(8): for column in range(8): ...
quest General Coding Help 18 3,448 Jan-23-2022, 11:57 PM
    Thread: Write the Matrix2 by using Matrix1
Post: RE: Write the Matrix2 by using Matrix1

(Jan-21-2022, 10:02 AM)ThiefOfTime Wrote: 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][co...
quest General Coding Help 18 3,448 Jan-22-2022, 12:41 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020