What is Python: Definition and 655 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. DiracPool

    MATLAB Learning Matlab & Python for a DARPA Grant

    I'd appreciate it if someone can give me a little guidance here. I'm slated to be entering a Ph.D. program in the fall where I'll be working on a machine intelligence project under a DARPA grant designed to create autonomous rovers. They want me because of my background in understanding the...
  2. BubblesAreUs

    Python problem: Plotting two functions against each other

    Homework Statement Enter a minimum height and velocity into plot function and return a velocity-height plot. Homework EquationsThe Attempt at a Solution # Find length of general list n = len(K) # Build a list for time [0,20] seconds ( Global) time = n*[0.0] # Acceleration of gravity g =...
  3. J

    Python Making a pretty n-body simulation

    Hi all, I have recently created an nbody simulation in Vpython for a few thousand particles where each particle is about 4000 times the mass of our Sun. Vpython is doing exactly what I want it to do the only problem being the output is extremely low quality (black spheres on a white...
  4. C

    Translate change of length to force in hanging chain problem

    I'm trying to write a simple script in blender python in order to show load deflection in cloth simulation. My question is: Is it possible to translate the change of length (distance between two nodes), into a force? (Newton between those nodes)? In addition you will find a minimal example. The...
  5. A

    Monte Carlo error calculation PYTHON

    I am using the monte carlo method to calculate the integral of cos^2(x). This is done using N random numbers. In my case I am doing it for 10^i random numbers when i ranges from 1-6. I want to calculate the error on the integral for each value of i used. I know for each value of N I want to...
  6. N

    How can I control FLIR camera (tau 2.4) by using Python?

    Dear Forum, I am trying to use Python to control FLIR camera (tau 2.4) but I do not know there is possible or not? I say that because I see when I connect IR camera to the computer using USB, it shows COM port in the Device Manager and I've seen python possible to work with COM port through...
  7. Pavkazz

    Help with Python computation to calculate age of universe

    Homework Statement I'm using python to calculate the age of the universe, by working out the distmodulus for a set of galaxys (using the V and I bands) then working out the distance in parsecs and then hubbles constant etc... I keep getting values that are 10s of magnitudes out which I assume...
  8. BiGyElLoWhAt

    Why is the duration an integer and why am I not getting any output?

    Homework Statement A rocket can either fire or not fire for a duration of 1-100ms with equal probability of firing/not firing. Determine how far it will go in the first 2 seconds of flight. Homework EquationsThe Attempt at a Solution # -*- coding: utf-8 -*- """ Spyder Editor This is a...
  9. S

    Are errors important in calculating integrals in Python?

    I am reading Mark Newman's Computational Physics textbook. He goes over calculating integrals with Simpsons's Rule and the Trapezoidal Rule, and then he goes over calculating their errors. Why would I have to ever worry about the error of the integral? He has the chapters online at his website...
  10. C

    What are the key differences between Python and Java?

    Hello all, If this has been asked before, please forgive me; what can Python be used for? Is it good for programming apps and whatnot? I have never done any programming before, so this is my very first programming language that I have just started learning. Thanks for answering
  11. T

    Improving Fourier Transform Visualization in Python

    Hello, My name is Thibaut. I am looking to improve my code in python in order to have a better look a my Fourier transform. as you can see on the image, we barely see any detail of the peaks on the image. Also it's not centred. the zero order peak in on the corner, not in the centre. Any idea...
  12. J

    Trying to learn Python; is this book incorrect?

    I had a brief stint with Python a year or two ago, and after I learned of the Raspberry Pi I knew I should try to learn again. I purchased this book, knowing full well that the online resources would be sufficient, and some of the code doesn't seem to work. hello_str = "Hello World"...
  13. Ryaners

    Using Python to calculate projectile motion with resistance

    I'm trying to write a program to calculate the trajectory of a projectile with air resistance. I've made the following function which calculates the position of the particle based on a given launch angle and initial velocity: def traj_fr(angle, v0): #function that computes...
  14. Mastermind01

    What should I do next after completing an introductory programming course?

    Hello, So I'm in high school and I wanted to self-study programming. In summer I completed the course Introduction to Computer Science and Programming Using Python on edX . I really liked it. I was wondering what I should do next and from where? Should I learn a different language (C , C++ and...
  15. C

    Writing Binary Files in Python 3.x

    Hi, I've been trying to write a simple binary file in Python 3 and have not yet been able to find a clear answer / solution online. Could you please suggest a simple way to read / write binary files in Python 3? My Code: # Create Binary File def dec_base(k,b=2): """ Default base is 2...
  16. L

    Non-linear elliptic differential equation - python

    Hey guys, I'm going to be honest and say I'm so stuck on this assignment - I really need help! I've took on a third year computational physics course last year - turn your weaknesses into strengths someone told me. Well, I failed and I'm back doing it again this year! So, I just have to pass...
  17. W

    Help designing an n-body gravity simulator in Python

    Hi everyone: I wanted to design a 2-dimensional gravity simulator as part of a larger research project. I wrote it in Python using numpy to store positions, velocities, and accelerations, and matplotlib to display the trajectories; code is available upon request. In order to solve the problem...
  18. Mark44

    Simple Python Debugging with Pdb: Part 2 - Comments

    Mark44 submitted a new PF Insights post Simple Python Debugging with Pdb: Part 2 Continue reading the Original PF Insights Post.
  19. H

    Beginning Python, cf dedicated calculator package

    I am no programmer but I want to learn for personal development. so physicsy type guys recommended Python. I downloaded it and have been playing. my goals for programming are three; 1. learn to code just for fun 2. do calculations and numerical calculations 3. input data from transducers...
  20. Mark44

    Simple Python Debugging with Pdb - Part 1 - Comments

    Mark44 submitted a new PF Insights post Simple Python Debugging with Pdb: Part 1 Continue reading the Original PF Insights Post.
  21. I

    Solving 3D Geometry Problems with Python

    Homework Statement Requirements: http://i.imgur.com/2WKyhto.png Homework Equations 2(L * W + L * H + W * H) SA = (2 * pi * radius * height + 2 * pi * radius^2) height = (volume)/(pi * radius^2) The Attempt at a Solution Code link: http://pastebin.com/sKFEGN0C
  22. Mr Davis 97

    Implementing some pseudocode in python

    I need to implement the following pseudocode in Python: N=5 #where N is number of years For (rate = 0.05, rate <= 0.15, rate = rate + 0.05) For (principal=10000, principal <=15000, principal=principal+1000) simple = principal * (1 + rate * N) #where N is number...
  23. H

    Python 2.7 on Windows installation for Astronomy

    Hello people i know this program is better to use on Linux, but for personal reasons i can't change to Linux OS. So I'm having a little problema on how to use python and install the modules of astropy, ipython, I've already installed pip but i have a error on python shell that says: Error...
  24. F

    Python How can I input a polynomial equation of infinite terms in P

    I have been given a task to create an interpolating/extrapolating programme. I have completed the programme for linear interpolation (2 points) but now must make it usable for 3 or more points, ie a polynomial of n points. I think I have the equation in general for a polynomial as it is an...
  25. BluberryPi

    Python vs Ruby: Which is Better?

    Hello! BlueberryPi here, and I have got a question for you: is Python better than Ruby? Background Info: Python is a strong programming language which allows GUI's to be built without much pain. It built sites like Google, You Tube, Pinterest, and DropBox. Ruby is a flexible language which...
  26. Mr Davis 97

    Why is type casting different in Java and Python?

    I am writing code in both Java and Python, and am a little confused about one thing: casting. In Python, we cast data types by using int(), str(), float(), etc. These are functions which convert one data type to its representation as another data type. However, in Java, it doesn't work like...
  27. E

    What are the good books for physics and python?

    What would be the good books on how to use Python (or any other language other than MatLab) and its capabilities on numerical physics?
  28. Mr Davis 97

    Python How to Convert Python Code to Effective Pseudocode?

    I have the following python code: I need to know how to best convert this to pseudocode. On one hand, I am afraid of making it too python specific, and on the other hand, it can't be too general. For example, for the 2nd and 3rd blocks of code, how would I write them in pseudocode? What...
  29. estv

    Interactive Website to Learn Python for EE Student

    Hi, I'm trying to learn python for electrical engineering application. Is there any interactive website to learn this, especially the one with interactive compiler or result animation? Maybe equipped with microcontroller simulator, LED, and actuator? (if is it possible) So far, I've tried...
  30. dylanreynolds1

    Computational General Relativity

    Hello all, first post. I have come here to get second opinions on the program I have written to compute the Einstein Tensor (the Riemann Tensor and Ricci Tensor). I enjoy looking for solutions to the Einstein Field Equations, however computing them by hand is not realistic. I decided to write a...
  31. E

    Simulating Saturn's rings in python

    Hi, I have to write a program in python (for school) that simulates a specific structure. I choosed saturn's rings. I've started by wrinting an N-body code. My goals are explaining the divisions in saturn rings as cassini division. I don't know if it's a great subject. The teacher told us to...
  32. S

    Resources for programming math solvers in Python

    Hi, I was just wondering if there were any good resources/sites for learning to plot and solve differential equations and any other math for that matter, specifically in Python? The physics program at ASU is great but we aren't really given any class time to learn how to program, it's all on our...
  33. R

    Simulating noise with Yuler and Burg

    Hi After removing high frequency white noise in my INS sensor, I want to simulate low frequency noise with Burg or Yuler. I used some functions in python to analyse the recorded data and to get parameters to use. But the the problem is the sequences generated diverge (and take very big...
  34. PhotonSSBM

    C, C++, or Python for solving Diff. Eq./other math stuff

    I have a friend who wrote a script for doing Runge Kutta and I didn't even know you could do that in Python. He's kind of poor at explaining stuff so I'm here to ask how one learns to do that. I'm a Physics/Comp. Sci. student who's still self teaching myself a lot of stuff. I've only taken an...
  35. Prof. 27

    Python DEAP Library -- List index out of range error

    Homework Statement So I'm currently modifying an example Symbolic Regression program that uses genetic programming, a type of evolutionary algorithm. I'm using the python deap library. Not sure if anyone on here is familiar with it, but I think that the error is more general to a misuse of...
  36. N

    Project euler 1 understanding the python code

    If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. This is the code for python I found (didn't create) which I believe is correct: max = 1000 result = 0 for...
  37. I

    Preparing for University: Maths and Python in 5 Months

    I am applying to University in January 2016 for either maths or computer science. I have taken the Gr. 12 prerequisite courses and did alright in them (calculus 89, physics 96, etc), but I feel I still do not have a solid foundation in maths to really feel comfortable going into a degree...
  38. Hercuflea

    [Python] Why does this loop execute 4 times?

    I've written a code which reads in an input file and extracts a number which represents a grid size, from lines in the file which can contain arbitrary characters. The extraction of the data seems to be working, but for some reason the loop executes 4 times and then moves on to the next...
  39. M

    Inconsistent values when integrating [Python]

    I have a 2D Gaussian: ## f(x,y) = e^{-[(x-x_o)^2 + (y-y_o)^2]/(2*{sigma}^2)}## which I converted into polar coordinates and got: ## g(r,θ) = e^{-[r^2 + r_o^2 - 2*r*r_o(cos(θ)cos(θ_o) + sin(θ)sin(θ_o))]/({2*{sigma}^2})} ## The proof for how this was done is in the attached file, and it would...
  40. C

    How much faster is Python than Mathematica?

    I've been running some of my own simulations of a variation on a standard map using Verlet integration on Mathematica, and I would like to start generating maps of phase space using ~25,000 initial points. I'm currently at 1000 points using Mathematica, and each simulation takes about 15 minutes...
  41. M

    Python: Generating a list and then matching question

    This seems like a fairly common technique but I'm fairly new to programming and don't quite know what the proper terms to find such an algorithm would be. In my case, it seems like a list of all possible values would approach almost a billion, and I feel like there's a quicker approach to...
  42. E

    Python 2.7: Fit a model to data

    Hi, I'm trying to get how well a known function fits to a set of data. I'm not interested in the data's line of best fit or anything, I just want to know how close it is to my model. I've tried using curve_fit and linregress but neither really give me what I'm after. My data follows a...
  43. M

    Python: Integrating a function but getting large errors

    My code: import numpy as np import matplotlib.pylab as plt import math import random from scipy import integrate R1 = .001 R2 = 7 def G(r,theta): sigma = random.randint(4000., 7000.)/1000. # width of beam is 4 - 7mm r0 = random.randint(0, R1*1000.)/1000. #random centroid theta0 =...
  44. NATURE.M

    Logistic regression: Stochastic Gradient Ascent (in python)

    So I've been following through a online course in machine learning offered by Stanford university. I have been recently reading up on logistic regression and stochastic gradient ascent. Here is a link to the original notes: http://cs229.stanford.edu/notes/cs229-notes1.pdf (pages 16-19). Here...
  45. cpscdave

    [Python] Function pointers & array of objects

    Maybe I am going about this the wrong way. I'm trying to build a form to display & update information in a object. The objects are stored in an array since I'll have 1-N of them. What I've done now is created an array of dictonaries which hold the information about the form fields, it...
  46. nomadreid

    Python for Dummies: what does scipy.inf really do?

    First, I am not even sure this is the right forum for this question, so if anyone wants to switch it to a more appropriate one, I would be grateful. Secondly, the question here is on one specific point of Python from a mathematical point of view. I neither know nor am learning how to program...
  47. I

    Verlet alghoritm and Lennard Jones simulation in Python

    Hello, I created script which draw plot of Lennard Jones potential for two particles. Now i want to create 2D simulation for 10 particles with verlet alghoritm but I have no idea how to create that. My problem is implementation of verlet alghoritm and calculating forces. I implemented boundaries...
  48. fluidistic

    [Python] Trying to debug my program

    Hi people, I'm trying to figure out what's wrong with my code. My goal is to calculate the average number of stones it takes so that 2 stones become adjascent on a 19x19 goban (the board of the game of go), when we randomly pick an intersection and place a stone on it. The answer should be...
  49. Shreyas Shree

    Make an android app in eclipse using python

    How to make an android app using python on eclipse.
Back
Top