python Definition and Topics - 168 Discussions

PYTHON was a Cold War contingency plan of the British Government for the continuity of government in the event of nuclear war.

View More On Wikipedia.org
  1. user366312

    How can I implement a multi-task deep learning neural network?

    I have 3 classes (A, B, and C). I have 6 features: train_x = [[ 6.442 6.338 7.027 8.789 10.009 12.566] [ 6.338 7.027 5.338 10.009 8.122 11.217] [ 7.027 5.338 5.335 8.122 5.537 6.408] [ 5.338 5.335 5.659 5.537 5.241 7.043]] These features...
  2. C

    I Solving 1-D Schrodinger Equation in Python (Scipy) Numerically

    I've tried to make an animation using python to demonstrate the 1-D simple harmonic oscillator and step potential examples. Hope that it can be useful for some of you. Have fun~ :) https://blog.gwlab.page/solving-1-d-schrodinger-equation-in-python-dcb3518ce454 By the way, If you are...
  3. hugo_faurand

    Help with the Python package Scipy and the Z-transform please

    Hello everyone ! I am working on ultrasound scan and the processing of the signal received by the probe. I made the model I wanted and as I do not have an ultrasound scan machine I want to simulate the signal processing. I will do that with the Python package Scipy and the function...
  4. V

    A Adding noise and solving stochastic ODEs in Python

    The Coupled ODE Model Below are my coupled differential equations, where the only variable I try to meddle with is the ITMblood. The motivation here is if I try to increase ITMblood (in the next section I will show how I do it), at some concentration of ITMblood (most likely a very huge one) ...
  5. B

    I Why is (N dot N) different for magnitude than for X, Y, Z components?

    I have to perform a calculation on my data. Here is an example of data from just one time step (data from other time steps would appear as additional rows). X Y Z Total 2 2 1 3 Total = SQRT(X2 + Y2 + Z2). The calculation I have to do is: (N • N), where "N" is an average. I tried...
  6. user366312

    Python Kindly explain this source code for me

    Check this link: How to override the copy/deep-copy operations for a Python object? Can anyone explain, in layman's terms, what is going on in this source code? from copy import copy, deepcopy class MyClass(object): def __init__(self): print('init') self.v = 10...
  7. B

    How to write basic syntax for triangle recursion?

    Hi, I'm new to programming in python [total beginner in programming] and I would like to ask you for your help. Here is what I got so far: import numpy as np import random from math import sqrt p = np.array([(0, 0), (1, 0), (1, (1/sqrt(2)))], dtype=float) t = np.array((0, 0)...
  8. T

    Scientific Computing: Method of Undetermined Coefficients in Python

    In a self learning project I am fooling around book https://faculty.washington.edu/rjl/fdmbook/ I want to do some of the computation myself to better understand the concepts but the book is Matlab based and Matlab is too expensive. Does anyone by any chance have some of the codes provided by...
  9. appletree23

    Comp Sci Finding the stability of a system using Python code

    I'm given this code to plot the system for task 1 where my teacher have used some random numbers just to show us how the code can be used: The code makes a plot that is given below: So my professor just gave us this code and plot without saying anything more. All the students in the class...
  10. B

    Python Minimization likelihood function with parameters

    Hallo at all! I'm learning statistic in python and I have a problem to show you. I have this parametric function: $$P(S|t, \gamma, \beta)=\langle s(t) \rangle \left( \frac{\gamma-\beta}{\gamma\langle s(t) \rangle -\beta}\right)^2\left( 1- \frac{\gamma-\beta}{\gamma\langle s(t) \rangle...
  11. Z

    Comp Sci Tackling Boundary Conditions in Python (Griffins Example)

    How to run a numerical simulation of Laplace equation if one of the boundary condition is like this: $$V(x,y) = 0 \text{ when } x \to \infty$$ I am trying to use Python to plot the solution of this Example 3.5. in Griffins EM
  12. Mikkel

    I One dimensional percolation

    Hello I am struggeling with a problem, or perhaps more with understanding the problem. I have to simulate a one dimensional percolation in Python and that part I can do. The issue is understanding the next line of the problem, which I will post here: "For the largest cluster size S, use finite...
  13. O

    Problem in solving differential equation

    Hello everyone! I was studying chaotic systems and therefore made some computer simulations in python. I simulated the driven damped anhatmonic oscillator. The problem I am facing is with solving the differential equation for t=0s-200s. I used numpy.linspace(0,200,timesteps) for generate a time...
  14. B

    Simulate the temperature inside an aquarium tank

    there's a website to size an aquarium heater or chiller. This is just for learning purposes (not for fish) but I have modified these parameters from default to perform a load calculation on a 100 gallon glass tank... For the tank temperature range I set to be between 150-160 degree F. and a...
  15. Daniel Lima

    Python How to plot a function with multiple parameters on the same set of axes

    I attached a file with some explanations of the variables in the code and the plot that I should get. I don't know what is wrong. Any help will appreciated. from scipy.integrate import quad import numpy as np from scipy.special import gamma as gamma_function from scipy.constants import e...
  16. CrosisBH

    Computing the wave function of a square potential

    The book's procedure for the "shooting method" The point of this program is to compute a wave function and to try and home in on the ground eigenvalue energy, which i should expect pi^2 / 8 = 1.2337.... This is my program (written in python) import matplotlib.pyplot as plt import numpy as...
  17. Avatrin

    Creating noise images with Python and OpenGL

    Hi I am learning how to do a line integral convolution with OpenGL given a vector field. So, as a first step, I need to learn how to create an nxn noise image. Are there any good tutorials/books I can use to learn how to do this?
  18. Jozefina Gramatikova

    Visualising a matrix in Python

    As part of a group project, we have been asked to create a code which produces the following matrix: I want to create the graphics of this in a way that looks similar to this: But of course with different number of cells, different colours, etc. The problem is that from what I have found...
  19. S

    Comp Sci Python Assertion Error Help

    I would like to make output only read: Traceback (most recent call last): AssertionError ... without giving the File "<input>", line 1, in <module>
  20. T

    Python Error due to the arrangement of conditions with an IF statement in while loop with an AND operator

    I am currently doing a leet code problem and came across something, I have not noticed before. Here is a sample of the code I am working on. s = "10#11#12" A=[] B=[] i=0 count=0 while i < len(s): if i+2<len(s) and s[i+2]=='#': A+=[(s[i]+s[i+1]+s[i+2])] i+=3 print(i)...
  21. Mikkel

    Python Numerical modeling of a glacier's length -- Coding error(s)

    Hey Physics Forum I am currently doing my bachelor project in geophysics, with focus on the evolution of glaciers in Greenland. My project consists partly of programming, because I want to get better at it. I have, however, hit a wall. I can't seem to figure out what is wrong with my code and I...
  22. B

    Second programming language to get under the belt: python vs C

    Hello everybody, I am a master student in Theoretical Chemistry and I am working in the DFT realm. Both TDDFT and DFT applied to extended systems (eg. using QUANTUM ESPRESSO). Of course I work with these softwares from a end-user point of view, not as a developer. But anyway, even if some of...
  23. L

    Intermediary projects in Python (Biophysics)

    Hello, I am an Undergraduate student looking for ideas for a project in Python. The project should contain a library filled with modules, classes (and preferably something with inheritance), and the unittest module. I would like to do something as follows: First, some kind ob WebScraping to...
  24. antoniacarol

    Python Python Coding-While Loops

    Please help! I am trying to create a Python program for an assignment that will convert Celsius to Fahrenheit and vice versa depending on the input from the user. The numeric conversion portion of the code is working, however, if the user inputs "exit" the while loop is supposed to terminate...
  25. C

    Python How can I evaluate a Chebishev polynomial in python?

    Hello everyone. I need to construct in python a function which returns the evaluation of a Chebishev polynomial of order k evaluated in x. I have tested the function chebval form these documents, but it doesn't provide what I look for, since I have tested the third one, 4t^3-3t and import numpy...
  26. S

    Comp Sci Python: printing every other input using a for loop

    I want my output to read only the integers. Here's my attempt: number = int(input()) for i in range(2, number+1, 2): print(input())
  27. T

    Python Converting List and tuples using str() function

    I am currently working my way through some w3schools python exercise on tuples and lists etc and one question was to write a program to converted a tuple to a string. Now originally I used the str() function on the tuple and printed the result. I then used the string in a for loop for a...
  28. D

    I need my 'fits' image file data to show up brighter than the background noise

    image_data = fits.getdata(alma_image, ext=0) plt.figure() plt.imshow(image_data, cmap='viridis', vmin=-4, vmax=4) plt.xlim(540,640) plt.ylim(540,640) plt.colorbar(extend='both') plt.clim(0, 1) plt.show()
  29. JayZ0198

    Multipurpose software that keeps C, Python, DSP, ... in the same file

    I’ve been looking for a certain type of software that can host programming (preferably C or Python) and other process that I’m going to need such as DSP, DSP filters, diagrams (3D graphs, charts,…), and text editing within the same file. It’s mainly so that I can incorporate and use each one...
  30. R

    Example illustraing Quantum programming

    I'm interested in quantum programming. So far I've managed to use Java and Python inside Datamelt computation project for physics simulations and for various statistical plots. Now I want to make a simple code that illustates quantum computing, and maybe even to visualize its principles (for...
Top