Python Definition and 655 Threads
-
P
Python Partial pivoting in getting the reduced row echelon form of a matrix
I assume the reader is familiar with row echelon form of a matrix and reduced row echelon form (rref) of a matrix, the latter which is unique for each matrix. For instance, the augmented matrix $$\begin{pmatrix} 1&0&1&1\\ 1&1&-1&2\\ 2&0&1&0 \\ 0&-1&1&-3\end{pmatrix}$$has rref...- psie
- Thread
- Linear algebra Python
- Replies: 2
- Forum: Programming and Computer Science
-
U
Issues with Apollo 11 TLI Simulation – Discrepancies in Return Orbit
Hi everyone, I'm working on a Python simulation that aims to replicate the Apollo 11 translunar injection (TLI) in a 3-dimensional geocentric system. My model includes Earth, the Moon, and a Saturn V–derived Apollo 11 rocket. The simulation starts at the moment of TLI, using initial positions...- UlrickAKobbeltvedt
- Thread
- Apollo Python Simulation
- Replies: 3
- Forum: General Discussion
-
Simulating a Rotary Inverted Pendulum in Python
[Mentor Note: Two threads on the same project have been merged into one] I need serious help with this. I'm totally stuck as to why my results are mediocre. It would mean a ton if someone could at least point me in the right direction. Below is my attempt: import matplotlib.pyplot as plt...- Remusco
- Thread
- Pendulum Python Rotary Simulation
- Replies: 15
- Forum: Introductory Physics Homework Help
-
B
Python relativity game in python
import pygame # Initialize Pygame pygame.init() # Get the screen resolution info = pygame.display.Info() WIDTH, HEIGHT = info.current_w, info.current_h # Set to the current screen size # Constants WHITE = (255, 255, 255) LIGHT_COLOR = (255, 255, 100) OBJECT_COLOR = (100, 255, 100)...- blackholesarecool
- Thread
- Python Relativity Special relativity
- Replies: 4
- Forum: Programming and Computer Science
-
H
Trying to install software on a new PC to run Python code I wrote in 2021
I have some Python code I wrote and ran in 2021. I'm trying to run it again. I have a computer I bought in 2024 running Windows 11. I used to run under Anaconda. I downloaded that. Attempts to run Spyder, the Python IDE, failed. It wouldn't execute. So I downloaded Spyder and Python. I...- Hornbein
- Thread
- Python
- Replies: 3
- Forum: Programming and Computer Science
-
[SOLVED] Python - Issues Taking an Input as an Integer (or Converting It)
This is one of the things I've tried: import numpy as np import matplotlib.pyplot as plt import math num = int(input("Enter an integer: ")) math.factorial(num) print("The factorial of this value is " + num + ".") And this is the resulting error message I get: TypeError: can only...- Ascendant0
- Thread
- Integer Python
- Replies: 1
- Forum: Programming and Computer Science
-
M
Can I Receive Help with SQL?
TL;DR Summary: Asking are you able to assist with problems relating to SQL coding and preparation Hi; I am looking to move into the fireld of Pyton and SQL working towards maybe employmnet in those fields (do people age 75n get jobs :-)) Anyway it looks daunting with ancillairy references to...- Martyn Arthur
- Thread
- Employment Python Sql
- Replies: 4
- Forum: Feedback and Announcements
-
Hello everybody!
First of all, merry Christmas! I'm quite new here and I've been told to introduce myself, so here it goes: There isn't much to say, I have no degree yet and little research/academic experience, as for my interests I like physics, electrical engineering and computer sciences, I know python...- dreadful_IBMPC
- Thread
- Electrical Physics Python
- Replies: 2
- Forum: New Member Introductions
-
Symbolic computation with partial derivatives and a double integral
I have an expression of a vector field ##\vec J = J_r \hat r + J_\theta \hat \theta## in polar coordinates, in a region that's a quarter of an annulus, where theta ranges between 0 and pi/2 and r goes from ri to ro. I need to compute ##-\int _\Omega T(S_{xx}-S_{yy}) \frac{\partial J_x}{\partial...- fluidistic
- Thread
- Calculus Python
- Replies: 5
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
Testing C & Python Resources for Problems in Astrophysics for upcoming CS Exam
Hi, I have a Computer Science exam (course contains Unix, C & Python) coming up which is part of my Astrophysics Masters degree. In the exam, I am allowed to carry all kinds of resources including PDFs of books, except connect to the Internet or use ChatGPT etc. I wanted to ask if anybody had...- warhammer
- Thread
- Astrophysics Computer science Python
- Replies: 6
- Forum: STEM Academic Advising
-
M
How can you modify Python code for effective graph plotting?
TL;DR Summary: How to understand the code determining the plot Hi; this is the code I have been given for a H-R diagram of M35; I understand the inversion concept.. The plot is below. I am trying to understand the code that creates its position and size and how to alter it to a more...- Martyn Arthur
- Thread
- Code Python
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
Trying to run a big python job with AWS (EC2), is there a better way?
I've got some code in a public repo with a module containing my model and a python script which runs the model and returns a .parquet file with data. I've parallelized all of the important processes with Joblib, and the underlying code is written in pure C so I can't make it much faster (at...- ergospherical
- Thread
- Python
- Replies: 7
- Forum: Programming and Computer Science
-
S
Unsolvable python code bug? (finding the difference between two input strings)
All day I have been trying to find a method of finding the difference between two input (body of text), and get the difference but in order. I have tried breaking down the text into separate lines, then try to find the difference between both lines, but somehow this doesn't solve the problem and...- Sucvicbil
- Thread
- Programming Python Text
- Replies: 2
- Forum: Programming and Computer Science
-
K
A How to use the Newton-Raphson method while keeping the sum constant?
Question: How to find solutions using Newton-Raphson method with keeping the sum of solutions? I am currently working on solving a high-dimensional equation to obtain accurate solutions using the Newton-Raphson method, which I have implemented in Python. However, my problem requires that the...- K-Manu
- Thread
- Numerical analysis Python
- Replies: 2
- Forum: General Math
-
B
A Efficient cone searches with Healpix-alchemy
I am trying to implement a cone search for a catalog with the HEALPix-alchemy package. I have the following models set up, based on the examples here: https://arxiv.org/pdf/2112.06947 class Field(Base): """ Represents a collection of FieldTiles making up the area of...- BOAS
- Thread
- Cone Python
- Replies: 0
- Forum: Astronomy and Astrophysics
-
A Problem using Gutzwiller-RVB theory for high-temperature superconductivity
I'm currently working on reproducing a graph from the Gutzwiller-RVB theory of high-temperature superconductivity using Python. The graph plots χ_BBxy versus Δ, where Δ ranges from 16 to 26. I've implemented the theory's iterative parameter update scheme but encountered discrepancies in the...- dieon
- Thread
- Python Superconductivity
- Replies: 0
- Forum: Atomic and Condensed Matter
-
F
Learning about Python application deployment - possible recommendations
Hello, I want to learn about servers and deploying Python applications simply (without going to AWS, Azure, etc. but something a little more complicated than deploying my app to streamlit Cloud). I would like to get some recommendations given the multitude of options. My goal is to create a...- fog37
- Thread
- flask Python Server
- Replies: 7
- Forum: Computing and Technology
-
J
Python Python scipy.optimize.minimize: ‘trust-constr’ and Hessian output
Hello, does anyone know how to retrieve the Hessian at the minimum when using method = ‘trust-constr’?- Joe Prendergast
- Thread
- Python
- Replies: 5
- Forum: Programming and Computer Science
-
F
Iterators and generators and the data they generate
Hello, I have been focusing on iterators and generators and I understood a lot but still have some subtle questions... An iterator, which is a Python object with both the __iter__ and the __next__ methods, saves its current state. Applying the next() method to an iterator gives us one item of...- fog37
- Thread
- Generators Python
- Replies: 1
- Forum: Programming and Computer Science
-
How Can You Draw from a PDF in Python Without the CDF?
Some python function f(x) defines an (unnormalised) pdf between x_min and x_max and say we want to draw x randomly from this distribution if we had the CDF F(x) and its inverse F^{-1}(x), we could take values y uniformly in [0,1], and then our random values of x would be x = F^{-1}(y). but...- ergospherical
- Thread
- Distribution Pdf Python
- Replies: 9
- Forum: Computing and Technology
-
F
Python Python Socket library to create a server and client scripts
Hello, I have been experimenting with the socket library in python creating small scripts, one called server.py and the other client.py, that can communicate with each other using a TCP protocol. The server script has an infinite loop that listens for request from the client.py script and...- fog37
- Thread
- Python Server
- Replies: 9
- Forum: Programming and Computer Science
-
Python Stop current Python REPL command, but keep REPL session open?
If you just typed in a command into the Python repl, and it is stuck in a synchronous "waiting-for-something-to-happen", how can we terminate just that command and return to the same repl session? For example, say we typed websocket.recv() and the websocket is waiting for a message... how can...- Swamp Thing
- Thread
- Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python How to store a large data-set in a "grid" in Python/NumPy
Say I have n parameters X1, X2, ..., Xn, and to each "grid-point" X = (X1, X2, ..., Xn) I want to associate a value f(X). So in the end I will have a structure like an n-dimensional matrix. Assume this data-set is going to be very large, i.e. each parameter Xi ranges over hundreds or thousands...- ergospherical
- Thread
- Grid Numpy Python
- Replies: 14
- Forum: Programming and Computer Science
-
H
35 years in technology as programmer/engineer
I'm working on a Python-based project to simulate fission energy containment. Details and GitHub link for collaboration coming soon. Looking forward to contributions.- humanlearning369
- Thread
- Nuclear fission Python
- Replies: 2
- Forum: New Member Introductions
-
Intro Physics Learn Python: Top Book Recommendations for Beginners
I'm looking at a book called python crash course for beginners (eric mathes), does anyone have experience of using this book or any other book that you would recommend for learning python if not that, is there a specific course you'd suggest that isn't in book form? I'm completely new to...- robotkid786
- Thread
- Beginner Programming Python
- Replies: 9
- Forum: Science and Math Textbooks
-
Physics How important is python for theoretical physics?
Hey guys, I'm a first year student studying theoretical physics in England. My physics modules include a fair bit of python programming and I want to apply to ICGs cosmology PhD in England. Can I escape learning python by choosing maths modules?- robotkid786
- Thread
- Physics Python Theoretical
- Replies: 23
- Forum: STEM Career Guidance
-
I Two-Mass Oscillator: Plotting Amplitudes Over Frequency in Hertz
Idea: Given a system of two coupled oscillators in which 2 masses are connected to a spring in the middle. Each of the two masses is coupled to another spring on the left and right, which have fixed ends but are not connected to each other. So we have 3 springs, two masses and the springs also...- tehsportsmaen
- Thread
- Coupled oscillator Integration Python
- Replies: 10
- Forum: Mechanics
-
F
Docker and Containers: Understanding the Basics and Common Doubts Explained
Hello, anyone on Physics Forums using Docker? I have understood the overarching idea behind Docker (packaging code, dependencies, etc. into a container that can be shared across OSs) but I have some doubts: I am confused about the base image line of code in the Dockerfile (which is simple text...- fog37
- Thread
- Python
- Replies: 6
- Forum: Programming and Computer Science
-
D
Is there a quick way to put quotation marks around strings in an array?
Hi everyone I'd like to cut and paste a list of words into an array. I'll need to put quotation marks around them all. Is there a way to do this other than to go through each word one by one? Thanks- Darkmisc
- Thread
- Arrays godot Python Strings
- Replies: 7
- Forum: Programming and Computer Science
-
Job Skills I know that this is about the hundredth topic I've made about this, but...
t I'm feeling lost. Currently, I'm trying to learn how to do web-development stuff in Python, so that I can have a project to show-off to prospective employers. I'm also aware that I may be deluding myself into thinking that one project is all it takes to get noticed. Moreover, I just lack...- Eclair_de_XII
- Thread
- Project Python
- Replies: 10
- Forum: STEM Career Guidance
-
R
How to Convert TMESH Data to Text Files in MCNP6 Using Python"
I would like to analyse mdata of tmesh in MCNP6 by python, but I am struggling how to convert mdata (unformatted binary) to any text file in python. I used GRIDCONV but it's not suitable for automations. I also used scipy.io.Fortrunfile but could not convert the file because I was not sure...- rai915
- Thread
- Mcnp6 Python
- Replies: 4
- Forum: Nuclear Engineering
-
F
I Is there a better way to calculate time-shifted correlation matrices?
Hello everyone. I have four thermometers which measure the temperature in four different positions. The data is distributed as a matrix, where each column is a sensor, and each row is a measurement. All measurements are made at exactly the same times, one measurement each hour. I have...- Frank Einstein
- Thread
- Matrix Python
- Replies: 2
- Forum: Set Theory, Logic, Probability, Statistics
-
F
How do Jupyter notebook components work together?
Hello everyone, As mentioned in past threads, jupyter notebook is a popular application that is used to code in Python (and other languages as well). The jupyter notebook installation includes 3 software components working together: 1) kernel: it interact with the web server 2) server: web...- fog37
- Thread
- Python
- Replies: 17
- Forum: Programming and Computer Science
-
F
Python Clarification about dir() in Python
Hello, Simple clarification about the built-in function dir() if possible: if we don't provide any argument, i.e. we use the function simply as dir(), the function displays the namespace of the function, of the module, etc. However, if we provide an input, the function dir() displays a list...- fog37
- Thread
- Python
- Replies: 2
- Forum: Programming and Computer Science
-
B
What programming languages does Bartb7 specialize in?
There's stuff on here relevant to my day-to-day, which means I may also be able to contribute. I'm primarily focused on programming in C, C++, Python and Perl. Nothing now, just introducing myself - hello all!- bartb7
- Thread
- C++ Programming Python
- Replies: 2
- Forum: New Member Introductions
-
I Finding the difference in Helmholtz free energy using thermodynamic integration
If there any solved papers or even python simulations to find this please share I understood the process of thermodynamic integration but computationally I want to see how this integration of average of derivative of coupled potential energy is done- VVS2000
- Thread
- Python
- Replies: 3
- Forum: Thermodynamics
-
J
I JC Model in Python: Advice & Feedback Needed - Jon Poplett
Good afternoon! I am fumbling my way through setting up a JC model in python, I was hoping I could get some feedback on it please. I just want to make sure everything looks good and the data I am collecting is valid. Any advice or feedback would be very welcome...- JonPoplett
- Thread
- Feedback Python
- Replies: 2
- Forum: Quantum Physics
-
Python Why Use Python for Web Scraping Instead of Excel?
My code is as follow: import pandas as pd from bs4 import BeautifulSoup import requests import os url = 'https://www.goodschool.hk/ss' response = requests.get(url) html = response.content soup = BeautifulSoup(html, 'html.parser') school_items = soup.find_all('div', {'class'...- Leo_Chau_430
- Thread
- Excel Program Python Web
- Replies: 13
- Forum: Programming and Computer Science
-
Python My Python Library For Finite Difference Method
I recently made a Python library for modelling (very basic) finite difference problems. The Github readme goes into details of what it does and how it works, and I put together a Google Colab with some examples (diffusion, advection, water wave refraction) with interactive visuals. I'd love to...- person123
- Thread
- Difference Finite Finite difference Finite difference method Method Modelling Python
- Replies: 8
- Forum: Programming and Computer Science
-
M
Python Can Fortran 77 Code Be Used to Debug Python Code for Solving ODEs Using Radau5?
Hi, I have a piece of Fortran code but I'm not Fortran literate. I'm trying to translate it into Python. I have already made it, but I need someone who can run the Fortran code to compare the values of the variables.- member 657093
- Thread
- Code Debugging Fortran Python Translation
- Replies: 64
- Forum: Programming and Computer Science
-
F
Python Create a Mask-RCNN Model in Python for Smart Parking Systems
Homework Statement: I am trying to write a Python code to do a project about smart parking system. I want to create a Mask RCNN model to detect the vehicles in the parking slots. My code is attached below, I got an error in the last line (creating Mask_RCNN model) and do not know how to solve...- falyusuf
- Thread
- Model Python Systems
- Replies: 1
- Forum: Programming and Computer Science
-
M
Python Graphing a piecewise function (Python)
I am trying to write a python script to plot the function, Where ##V_0 = 5~V## ##t_0 = 10~ms## ##\tau = 5~ms## My script that I have written to try to do this is, Which plots, However, the plot is meant to look like this with the horizontal line. Can someone please give me some guidance to...- member 731016
- Thread
- Function Graphing Piecewise function Python
- Replies: 2
- Forum: Programming and Computer Science
-
S
Python Help with Histogram and Boxplot in Python
I could really use some help here, I am a transfer student so my course load is all out of order. I have a statistics course that requires me to use Python to solve this one question (the 2 parts shown below). I never took any sort of coding before, I don't know where to even start. Can anyone...- SShep71
- Thread
- Histogram Python
- Replies: 3
- Forum: Programming and Computer Science
-
Python Speed of function vs lambda calls in python
An observation I made earlier- something like def f(...): ... return ... def g: ... = f(...) was quite a bit slower than doing def g: f = lambda ... : ... ... = f(...) any reasons why?- ergospherical
- Thread
- Function Lambda Python Speed
- Replies: 2
- Forum: Programming and Computer Science
-
B
Python FineTune the Pixel2Style2Pixel model with my custom data set
I want to fine-tune the Pixel2Style2Pixel model with my custom data set, but I keep getting an error when I'm trying to load in the pre-train weights. Here is my code : # Load the pre-trained model os.chdir("/content/pixel2style2pixel") from models.psp import pSp config = { "lr": 0.0001...- btb4198
- Thread
- Data Model Python Set
- Replies: 3
- Forum: Programming and Computer Science
-
Python Thermal lattice Boltzmann model ignoring source term -- python code help please
LBM model for phase change- relevant equations found here. Also here. #Thermal LBM #solves 1D 1 phase phase-change #D2Q5 Lattice nx=100 # the number of nodes in x direction lattice direction ny=5 # the number of nodes in y...- Gwen
- Thread
- Boltzmann Code Lattice Lattice models Model Phase change Python Source stefan Term Thermal
- Replies: 1
- Forum: Programming and Computer Science
-
F
Python Automatic parking slots detection using Python
TL;DR Summary: How to automatically detect the parking slots using Python? I have a Deep Machine Learning course and would like to do my course project about "Available Parking Slots Detection using Deep Machine Learning Based on Image Processing". My plan is to split the project into two...- falyusuf
- Thread
- Automatic Detection Python
- Replies: 6
- Forum: Programming and Computer Science
-
Python What are the limitations of Codon, the new Python compiler?
See this story here in a press release from MIT: https://news.mit.edu/2023/codon-python-based-compiler-achieve-orders-magnitude-speedups-0314 Basically, any working Python module can be compiled one time only, and then run 10+ times faster than interpreted code, with no further changes to...- jim mcnamara
- Thread
- Compiler Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python GTRPy - A python package for General Relativity Related Calculations
Hello, everyone I am now working on this project quite a while now and I just wanted to share it with this forum, which I was a member for a long time. I am working on a python application about GR and I believe I managed to create a very user-friendly layout. It's called GTRPy, and it allows...- Arman777
- Thread
- Calculations General General relativity Python Relativity
- Replies: 7
- Forum: Programming and Computer Science
-
S
Comp Sci Plot periodic function with Fourier coefficients
I have plotted the function for ##T=15## and ##\tau=T/30## below with the following code in Python: import numpy as np import matplotlib.pyplot as plt def p(t,T,tau): n=np.floor(t/T) t=t-n*T if t<(2*np.pi*tau): p=np.sin(t/tau) else: p=0 return p...- schniefen
- Thread
- Coefficients Fourier Fourier coefficients Fourier series Function Periodic Plot Python
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help