Python Definition and 655 Threads
-
Python 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...- JayZ0198
- Thread
- C++ Dsp File Python Software
- Replies: 6
- Forum: Programming and Computer Science
-
Python Python equation solver, I'm getting a floating point error
I am trying to solve the equation like this, from sympy.solvers import solve from sympy import Symbol import math x = Symbol('x') A, B, C, D = 0.59912051, 0.64030348, 263.33721367, 387.92069617 print(solve((A * x) + (B * math.sqrt(x**3)) - (C * math.exp(-x / 50)) - D, x , numerical = True))...- Arman777
- Thread
- Error Floating Point Python
- Replies: 9
- Forum: Programming and Computer Science
-
T
Python Flow Chart For a 'for' Loop In Python
I am currently learning python and to understand the my code fully and to make notes I am trying to draw flow charts to compliment my code. My issue is I am not sure what to put in the flow charts or really how to represent them as clearly as possible. I have done a google search but I am bit...- Taylor_1989
- Thread
- Flow Loop Python
- Replies: 66
- Forum: Programming and Computer Science
-
W
Python Using different IDEs (Anaconda, IDLE) for Python 2.7, 3.5 Respectively
Hi, I would like to be able to use both IDLE and Anaconda Navigator/Jupyter IDEs for Python 3.7 (64-bit), 2.7 respectfully. I can open up and work with IDLE. I understand Python 2.x is for legacy systems mostly but I spent a lot of time using data analysis packages in/with Anaconda for 2.7 and...- WWGD
- Thread
- Python
- Replies: 3
- Forum: Programming and Computer Science
-
N
Python How to combine integration equation in Python?
I'm calculating key rate (R^Rate-wise) by integrating R(eta) over all possible eta from 0 to 1, with a probability distribution (PDTC) which is a log-normal distribution. The equation of log-normal distribution: The equation of R(eta): Therefore, R^Rate-wise =...- Nur Ziadah
- Thread
- Integration Python
- Replies: 1
- Forum: Programming and Computer Science
-
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...- romerol
- Thread
- Example Java Programming Python Quantum
- Replies: 4
- Forum: Programming and Computer Science
-
Python Showing rotational trajectory with Python
Hi I have a list of 3D angular velocities (a numerical solution to an ODE). I want to show the trajectory this rotation would cause by mapping it out on the unit sphere. How can I go about doing that? What is the best way to approach this?- Avatrin
- Thread
- Python Rotational Trajectory
- Replies: 8
- Forum: Programming and Computer Science
-
Animation using matplotlib query
I am trying to animate a plot of two distinct points (blue and green points) moving about the complex unit circle using Python's Matplotlib library. The problem I am having is that the animation does not remove and update the previous data points but rather sequentially smears it on the unit...- Danny Boy
- Thread
- animation code matplotlib python
- Replies: 1
- Forum: Programming and Computer Science
-
Python Damped & Driven Pendulums (in _pure_ Python)
This is another application of using Taylor recurrences (open access) to solve ODEs to arbitrarily high order (e.g. 10th order in the example invocation). It illustrates use of trigonometric recurrences, rather than the product recurrences in my earlier Lorenz ODE posts. Enjoy! #!/usr/bin/env...- m4r35n357
- Thread
- Chaos Damped Ode Pure Python Taylor
- Replies: 2
- Forum: Programming and Computer Science
-
W
Python Using Different Versions of Python - Compatibility/Dependencies?
Hi All, I am trying to learn versions 2,3 of Python ( long story). Just curious as to the "Dependency/Compatibility" issues between and within versions 2 and 3. Are packages/libraries in 3.x available for 3.x' where x'>x ? How about for version 2? Specifically, at this point, I am trying to...- WWGD
- Thread
- Python
- Replies: 54
- Forum: Programming and Computer Science
-
Python What downloads are required to work with Python?
Hey everyone! This might be a bit of a dumb question, but I'm not familiar with much in the programming world. I know a few languages that I've learned on my own (online) or through a course in school (MATLAB). When it comes down to coding outside of MATLAB or a website, I'm not sure where to...- starstruck_
- Thread
- Beginner Python Work
- Replies: 3
- Forum: Programming and Computer Science
-
W
Python De-Shebanging a Python program file
Hi all, I had shebanged a Python program file to train myself to run Python from the command line or search box. Problem is now I cannot access my old text-based .py files. Every time I click on them to open, they run in the command line. How can I access the text format again?- WWGD
- Thread
- File Program Python
- Replies: 10
- Forum: Programming and Computer Science
-
Python How to plot vector fields in Matplotlib
Hi, I want to plot the vector field ##\vec F = ye^x \hat i + (x^2 + e^x) \hat j + z^2e^z \hat k## The code I have tried: # The components of the vector field F_x = y*e**x F_y = x**2 + e**x F_z = z**2*e**z# The grid xf = np.linspace(-0.15, 2.25, 8) yf = np.linspace(-0.15, 2.25, 8) zf =...- JD_PM
- Thread
- Fields Matplotlib Plot Python Vector Vector fields
- Replies: 1
- Forum: Programming and Computer Science
-
C
Python How to estimate a GARCH model in python (without standard function)?
Hi, I want to program an GARCH model for exchange rates. To do this, I calculated the residuals. Next, I did the following (in python) def main(): vP0 = (0.1, 0.05, 0.92) a = minimize(garch_loglike, vP0, eps, bounds = ((0.0001, None), (0.0001, None), (0.0001, None))...- Cyn
- Thread
- Estimate Estimation Function Model Python Standard
- Replies: 1
- Forum: Programming and Computer Science
-
Python How to make an animation in SymPy using Python
I want to make an animation where a (red) ball departs from (0,0) and draws the function ##f(x) = sin x## This is what I know: How to plot ##f(x) = sin x## To do so I followed instructions from the worksheet. Actually I'd have done: But I guess they want to me to it in that way because...- JD_PM
- Thread
- Animation Python
- Replies: 4
- Forum: Programming and Computer Science
-
Python Plotting a Helix in Sympy: Troubleshooting and Tips
I asked this question on SO, but I am having problems with it (I cannot even get into my account now). It seems that people using the IP I am using are asking a lot and that limits the number of questions I can ask. Please have a look at my question. Here's the link: [Moderators note: bold large...- JD_PM
- Thread
- Helix Plot Python
- Replies: 6
- Forum: Programming and Computer Science
-
Python What is the Nelder-Mead algorithm and how can it be implemented in pure Python?
Adapted from this code, which is an implementation of the algorithm described here. Removed dependency on Numpy Use as library code or test Himmelblau's function from copy import copy from sys import stderr, argv def replace_worst(data, new): del data[-1] data.append(new) def...- m4r35n357
- Thread
- Pure Python
- Replies: 3
- Forum: Programming and Computer Science
-
Python How to generate a tiling (in python if possible)
I was reading this wikiperdia article on polyminos (https://en.wikipedia.org/wiki/Polyomino). The pictures look very nice. Example I want to learn how to generate these figures myself in an interactive way. Basically I want to start with a polymino and then I want to be able to translate (by...- caffeinemachine
- Thread
- Python
- Replies: 5
- Forum: Programming and Computer Science
-
Looking for a bunch of solved Sympy problems (Calculus)
Two weeks ago I had no idea on how to code using Python. Now I have completed an online course on functions, loops and strings. However, in that course I did not practice using the specific library called Sympy. Besides, I will use Python in the Physics-Math background, for solving problems like...- JD_PM
- Thread
- Calculus Python Vector calculus
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
Python Python for Vector Calculus: Books & Online Resources
I am looking for a book for learning Python so as to compute matrices, eigenvalues, eigenvectors, divergence, curl (i.e vector calculus). If you also have online recommendations please feel free to write them.- JD_PM
- Thread
- Books Calculus Python Resources Vector Vector calculus
- Replies: 2
- Forum: Programming and Computer Science
-
Python What are Good Reference Books for Python?
Back in the day, when Perl was my go to language, Programming Perl, the Camel Book, from O'Reilly was The Reference. It was the quick and concise way to get an answer. And you'd probably learn something you weren't necessarily looking for and get a chuckle along the way. Now that Python is my...- websterling
- Thread
- Books Python Reference
- Replies: 3
- Forum: Programming and Computer Science
-
K
Python Visual Python Pendulum: Solving the Forces
Hello and thanks in advance for your help. For about a week now, I've been trying to write what should be a simple python program. The idea is first to write a program for a simple harmonic pendulum, then adapt it to a spring pendulum. However, in order to do this, I have to write the simple...- Kaimyn
- Thread
- Nuclear Numerical algorithms Pendulum Potential Python Visual
- Replies: 7
- Forum: Programming and Computer Science
-
C
Python 3d interpolation in Python using a mesh grid
I have four arrays of data xvalues[], yvalues[], zvalues[] and wvalues[] and I want to create, from this data, an interpolated function w = f(x,y,z). Is it easy to do this in python using first a meshgrid and then calling scipy's interpolation? e.g toy set up is something like, where wvalues...- CAF123
- Thread
- 3d Grid Interpolation Mesh Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python How to GOTO a certain line in Python to repeat?
Hi everyone, I'm trying to create a sequence that evaluates r for i= 1 to 10 and 100 to 110 ...N (evaluate 10 skip 90 repeats till N). If python has a GoTo function, I would've used it to return the previous line to repeat. But I couldn't find a function like that anywhere on the internet. 1...- Othman0111
- Thread
- Line Python
- Replies: 6
- Forum: Programming and Computer Science
-
Python Suggestions for books about scientific computing using Python
Looking for suggestions on books (or other learning material) that will help me improve my skills using Python for scientific computing. I am comfortable with Python programming (syntax, conditional statements, loops, etc.), and use it for data analysis in my undergraduate experimental physics...- GoldenBear
- Thread
- Books Computing Python Scientific Scientific computing Suggestions
- Replies: 2
- Forum: Programming and Computer Science
-
Python I writing a program telling time on Python
Homework Statement "Using the time module, write a program that tells one the current time in hours, minutes, and seconds, and time since January the first of 1970." Homework Equations import time % = mod division int = returns integer value of number The Attempt at a Solution import time...- Eclair_de_XII
- Thread
- Program Python Time Writing
- Replies: 3
- Forum: Programming and Computer Science
-
A
Python How to get output from a layer during training in Keras?
In Keras, the method model.fit() is used to train the neural network. How can I get the output from any hidden layer during training? Consider following code where neural network is trained to add two time series #multivariate data preparation #multivariate multiple input cnn example from numpy...- Atr cheema
- Thread
- Machine learning Output Python
- Replies: 7
- Forum: Programming and Computer Science
-
W
Python Extended Comments for Python 3?
Hi All, I am having trouble figuring out how to do extended, i.e., many-lined, comments. I know the format is ( copied from website): “””” Problem is that, while I can find the '' in my Qwerty keyboard, I can't figure out how to find the rest in my keyboard. I assume all Qwertys are the...- WWGD
- Thread
- Python
- Replies: 10
- Forum: Programming and Computer Science
-
Sites for some practice programming
This is not a question, but a note, which I thought could help students. I thought I would share this here, as people may be looking for practice problems. My professor in the Python course I just finished recommended https://projecteuler.net/ as a site to practice using programming skills...- scottdave
- Thread
- Programming Python
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
W
Python Using Python 32-bit (with Idle) in 64-bit System
Hi, I somehow carelessly installed Python 3.72, 32-bit in my 64-bit system. Is this a workable situation or will I pay a price eventually in a conflict between 32-bit software living in a 64-bit system? Should I uninstall and reinstall a 64-bit version?- WWGD
- Thread
- Python System
- Replies: 10
- Forum: Programming and Computer Science
-
MATLAB How can attenuation be removed using SCIPY or MATLAB?
Dear Sirs, I have a signal which has an attenuation of 20dB per decade, how do I remove this attenuation using SCIPY? Alternatively how to do it in MATLAB if there are no SCIPY users here? I'm a SCIPY/MATLAB novice fyg. Thank you for your kind assistance Abim- Abimbola1987
- Thread
- Attenuation Matlab Numpy Python
- Replies: 23
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
Python More cool automatic differentiation (Hamiltonian)
Well I think it is cool anyhow ;) Here is a dependency-free variable-order double pendulum simulation in about 120 lines of Python. Have you seen the equations of motion for this system? As usual, this is based on code that I have provided here, but trimmed for maximum impact. Can you see...- m4r35n357
- Thread
- Automatic Cool Differentiation Hamiltonian Python
- Replies: 16
- Forum: Programming and Computer Science
-
Python Doubt regarding a basic Python operator
Hi everyone, I am beginner in python programming. So many doubts are being generted in the learing process Can anyone please explain me how the bitwise NOT (~) operator actually works on values. I have attached a screen short of my textbook (unofficial) with this post and I am confused how...- jishnu
- Thread
- Doubt Operator Python
- Replies: 7
- Forum: Programming and Computer Science
-
N
Python How to plot integration equation using Python?
I have a few of integration equations and need to convert it into Python. The problem is when I tried to plot a graph according to the equation, some of the plot is not same with the original one. The first equation is the error probability of authentication in normal operation: cond equation...- Nur Ziadah
- Thread
- Integral Integration Plot Python
- Replies: 21
- Forum: Programming and Computer Science
-
K
Python Perform an image deconvolution using FFTs and Python
Homework Statement [/B] This problem is from Mark Newman's Computational Physics, problem 7.9, found at http://www-personal.umich.edu/~mejn/cp/exercises.html. The problem gives us a blurry convolved image, according to a Gaussian point spread function and our objective is to deconvolve it to...- kaashmonee
- Thread
- Computational physics Deconvolution Fast fourier transform Image Numpy Python
- Replies: 1
- Forum: Programming and Computer Science
-
N
Python How to fix the error probability plot in Python for MIM and PNS attacks?
I have several equations and need to convert it into Python. The problem is that I tried to plot a graph according to the equation. However, the graph that I get is not the same as the original one. In the paper, the equation of error probability for MIM attack is given by: First Image Second...- Nur Ziadah
- Thread
- Convert Python
- Replies: 4
- Forum: Programming and Computer Science
-
The order of calculating velocity and position alters the solution?
So I tried solving the differential equation for a spring - mass system using Euler's Algorithm in Python. The equation being d2x/dt2= -4π2x (The equation was obtained by Dimensional Analysis) here x and t are both dimensionless equivalents of position...- TachyonLord
- Thread
- Computational physics Mechancis Position Python Simple harmonic oscillator Velocity
- Replies: 31
- Forum: Mechanics
-
D
Python Python program to calculate Kirkwood−Buff Integrals
I want to write a python program to calculate the Kirkwood−Buff Integrals. The equation is as: G=4π∫0 ∞ r 2 [g(r)-1] dr I have the g(r) values. Any suggestions are highly appreciated. Thank you.- DHN
- Thread
- Integrals Program Python
- Replies: 7
- Forum: Programming and Computer Science
-
Python Python: Simulation of the Solar System and Total energy
Homework Statement I have a project to make the Solar system on Python, which I have done, but they also require from us to calculate the total energy of the system. We don't have to make the orbits of the planets elliptical, they should be circular and I believe I made them like that. Since...- Jozefina Gramatikova
- Thread
- Energy Python Simulation Solar Solar system System Total energy
- Replies: 24
- Forum: Programming and Computer Science
-
J
Python Physics books with Python examples
Hello, I have found two books that show physics branches with python examples: This is for mechanics: https://www.springer.com/us/book/9783319195957 The other on oscillation and waves: https://www.springer.com/la/book/9783319723136 I see in these books that the University of Oslo is doing...- jonjacson
- Thread
- Books Physics Physics books Python
- Replies: 4
- Forum: Programming and Computer Science
-
Python Simulating Gravitational Interactions in a Particle System
I have a project to make the solar system. I am trying to start from somwhere. On the notes it says that we need to start by creating a System of Particles Two-body simulation (Circular motion) Implement Gravitational acceleration Each particle (planet) could have its own field. I.e. Each...- Jozefina Gramatikova
- Thread
- Programming Python Solar Solar system System System of particles
- Replies: 4
- Forum: Programming and Computer Science
-
J
Python Contour plot of Earth's magnetic field in Python
The Earth's magnetic field is cylindrically symmetric and can be described using cylindrical coordinates, (ρ,z,φ). The components of the magnetic field are given by: (B_φ) = 0 (B_ρ) = −∂A/∂z, (B_z) =(1/ρ) * ∂(ρA)/∂ρ. The vector potential for a dipole field is given by (A_φ) = (B_e)(ρ) *...- jackthestudent
- Thread
- Contour plot Field Magnetic Magnetic field Matplotlib Plot Python
- Replies: 4
- Forum: Programming and Computer Science
-
Python Python 3.0 , encoding="utf-8" for encryption
I had recently upgraded my version of python from 2 to 3. I had a program that encrypted a text file by converting a character to its Unicode value, altering it and then changing it back to a character using the ord() and chr() methods. This does not seem to work with python 3 and I was...- NihalRi
- Thread
- Encryption Python
- Replies: 3
- Forum: Programming and Computer Science
-
Python Lorenz ODE solver in 35 lines of pure Python
Features: No external dependencies. Arbitrary order simulation (accuracy limited by float precision). No finite difference errors. Can be extended to arbitrary precision with gmpy2 and two more lines. Enjoy! Parameters: order step size number of steps initial conditions (x, y, z) parameters...- m4r35n357
- Thread
- Lines Lorenz Ode Pure Python
- Replies: 17
- Forum: Programming and Computer Science
-
Python How can I adjust the range and scaling for a cos function in Python?
r = np.arange(0,400,0.1) t = np.cos(r)+10 plt.plot(r,t) How can I use the range of the cos function to look like this- Arman777
- Thread
- Cos Function Graphing Python
- Replies: 6
- Forum: Programming and Computer Science
-
Python How to Modify Python Dice Rolling Game to Accept User Input for Number of Rolls?
Homework Statement I want to prompt the user to input how many times they want to roll a die, then generate a random number between 1 and 6. I then need to print what their number is and if it is even or odd. The code I posted below is what I came up with for a single die roll that allows...- jdawg
- Thread
- Dice Game Python Rolling
- Replies: 17
- Forum: Programming and Computer Science
-
I
Python Different answers for division in Python 3
Hello Consider the following code in Python3 n = 226553150 m = 1023473145 n*m = 231871064940156750 int(n*m/5) = 46374212988031352 n*m//5 = 46374212988031350 Now since ##n*m## is divisible by ##5##, both should be give the same answer. But the first is wrong and second is correct. What is...- issacnewton
- Thread
- Division Python
- Replies: 7
- Forum: Programming and Computer Science
-
M
Python How to drop rows when there is a length mismatch?
I am trying to drop the series size so that it matches the size of the dataframe as I need to copy the index value of the series into the df but I am getting mismatch errors. df has a size of 100 but time has a size of 200 so I want to remove the extra rows in time to match df. how can i handle...- msn009
- Thread
- Drop Length Python
- Replies: 5
- Forum: Programming and Computer Science
-
M
Python How to plot timeseries data in Python
I have a dataframe that looks as attached. What I aiming to do is to plot the lines for each type where if it is for type A, I want to be able to have two lines in the graph that shows the trend for type A. I was not able to find any examples online especially with the format of the data in this...- msn009
- Thread
- Data Plot Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python What's wrong with my if-else statements in Python 3?
Goal: I'm trying to allow the user to input varying spellings for certain auto services, and still have my code work properly. My goal was to use the if-else statements to ensure that if the user misspelled a service, the code could correct the error by changing the variable assignment to the...- astroman707
- Thread
- If statement Python Variable
- Replies: 18
- Forum: Programming and Computer Science