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. O

    Python Exploring AI Programming Languages: AIML, Lisp, C++, and Python

    I found an article about AI programming languages (https://qubit-labs.com/ai-programming-languages-choose/) and I've got several questions: 1. Are AIML and Lisp still used in programming? 2. Several sources refer to C++ as the fastest programming language? In what way the speed of language is...
  2. A

    Help with Python modelling of a particle in a 2D box

    Hello guys, I programmed a physics simulation where a particle with some initial conditions bounces off the walls of a 2d container. The simulation also includes gravity in the y-coordinates. The aim of the project is to produce a visual animation and further on include more particles and...
  3. Jamison Lahman

    Algorithm Optimization [Python]

    Homework Statement Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum. sum_pairs([11, 3, 7, 5], 10) # ^--^ 3 + 7 = 10 == [3, 7] sum_pairs([4, 3, 2, 3, 4]...
  4. maajdl

    Python, Julia, Jupyter .... clouds

    Hello, Since a few months I enjoy learning and using Python, Julia, R, Jupyter. I abandoned Fortran long ago. Today, I decided to break with the more recent past. I will stop computing in Excel and C#, (mainly for process simulation, since more than 10 years) ... I would also like to stop...
  5. S

    Python How to Correctly Simulate an Infinite Well in Python?

    I'm trying to get the eigenfunctions and eigenvalues (energies) of an infinite well in Python, but I have a few things I can't seem to fix or don't understand... Here's the code I have: from numpy import * from numpy.linalg import eigh import matplotlib.pyplot as plt from __future__ import...
  6. Jamison Lahman

    What is the Intel Distribution for Python and how can it improve data analysis?

    Hello, I am relatively new to Python. I would really like to use Python for numerical and data analysis. I recently stumbled upon something called Intel Distribution from this article: http://www.infoworld.com/article/3117239/data-science/intels-python-distribution-turbocharges-data-science.html...
  7. E

    Python How to Install the Basemap and the GEOS Library?

    I have been following this procedure on installing the basemap and the GEOS library: https://matplotlib.org/basemap/users/installing.html I have searched through other alternatives, but they seem to provide the same procedure. I need help on understanding the "Installation" process. I am using...
  8. S

    Numerical integration in Python (throwing a ball)

    Homework Statement I have a problem with my physics task, but you do not need to understand physics to be able to help me, because my main problem is bad programming skill. I am dealing with a problem of throwing a ball in the air at an angle between 0 an 45 degrees. I need to consider not only...
  9. O

    Python Wave on string: How can I create a traveling triangle pulse?

    I have the following program that moves a wave on a string with fixed ends. The program solves the wave equation given a initial condition wave. The initial condition is a triangle wave splitting into two pulses. Here is the code written in Python: from numpy import * from matplotlib.pyplot...
  10. X

    N-body simulation - straight line orbits

    Homework Statement The problem is your typical N-body simulation, implemented using Python and Numpy. The implementation specifically calls for using the Euler-Cromer method. For this particular case I used the Sun and the first 4 planets of the solar system. Essentially the problem is I'm...
  11. arnazkh

    How Can I Plot Multiple Alpha Values in Cosmology Using Python?

    Hello! I've been working on a code that solves the Friedmann equation with quintessence using a scalar field potential of the form x^(-alpha) where alpha is a free parameter. I would like to plot different values of alpha in the same plot with annotations for each. For now, my code has initial...
  12. A

    MATLAB Python and MATLAB giving different results for same code?

    I am trying to learn Python by translating my MATLAB codes into Python. My translated Python code is giving slightly different result as compared to that of MATLAB. Although difference is very small but it affects largely the results at later stage. My Python code is import numpy as np import...
  13. L

    Recursion in python functions -- confusion

    example code from python-course.eu def factorial(n): print("factorial has been called with n = " + str(n)) if n == 1: return 1 else: res = n * factorial(n-1) print("intermediate result for ", n, " * factorial(" ,n-1, "): ",res) return res...
  14. FallenApple

    How to build a linked list in python

    Homework Statement [/B] Build a linked list with values of 1, 2 and 3 The Attempt at a Solution class ListNode(object): def _init_(self,x): self.val=x self.next=None root=ListNode(1) root.next=ListNode(2) root.next.next=ListNode(3) print(root.val) I keep...
  15. M

    Python Merging FITS Images with Python & Astropy

    Hello everyone, I would like to know how I can combine two FITS images (which are continuum maps of two sources) in python using astropy. Bests
  16. Avatrin

    Python Progressively harder Django challenges

    Hi I am trying to improve my resume by making websites using Django (I own two websites). However, I am not sure how to get started. I just want to create something that makes me more employable. I have used Python in mathematics and physics. I am going through the Codeacademy courses on HTML...
  17. S

    Object-Oriented Implementation of Python ATM Script: Where Did I Go Wrong?

    hello everyone, I am a new member of this forum I found really good topics and good community that helps with many scientific fields. So I have this long text-based user interface for banking system written in python functions , but needs to be written using object oriented programming. I had...
  18. doktorwho

    Great, glad to hear it's working now! Happy coding :)

    Homework Statement Define a procedure that does the following: From the string of numbers from 1 - 9 it creates a list that contains the numbers that are bigger than the preceding number and adds the smaller ones to a sub-list. Example: string='3057842103' print(numbers_in_list(string))...
  19. doktorwho

    What is the mistake in this Sudoku checker code?

    Homework Statement # Sudoku [http://en.wikipedia.org/wiki/Sudoku] # is a logic puzzle where a game # is defined by a partially filled # 9 x 9 square of digits where each square # contains one of the digits 1,2,3,4,5,6,7,8,9. # For this question we will generalize # and simplify the game. #...
  20. doktorwho

    Python Which of these training websites would you recommend?

    I would be really thankful if you could check out them because I'm kinda indecisive about everything and i want your opinion on this. I was looking for a website that would have programming problem sets set in order so i could solve them and also have fun. I'm a python newbie and this is what i...
  21. doktorwho

    Python Why does my code produce incorrect output?

    # Use Dave's suggestions to finish your daysBetweenDates # procedure. It will need to take into account leap years # in addition to the correct number of days in each month. def nextDay(year, month, day): n=month if (n==1 or n==3 or n==5 or n==7 or n==8 or n==10 or n==12) and day < 31...
  22. S

    MATLAB Python to Matlab Conversion for fscanf & DWT

    Hello, 1. Homework Statement I find diffuculties to transform fscanf and to apply the discrete wavelet transform order 2 from matla to python. Homework Equations This is the MATLAB code: D_P=fopen('distance_profil.txt','r'); i=0; while(feof(D_P)==0)% test for end of file i=i+1...
  23. Avatrin

    Python What Projects Can I Build Using Django?

    Hi I am having a hard time finding what specifically Django allows me to do, and why people are using it. I am seeing a lot of places hiring people who know Django. Python is something I already use for mathematical modelling, so I want to try working with Django. I have a website, so I want...
  24. doktorwho

    Python Which of these codes do you think is the simplest

    Since i don't know how to write code here on forums i will upload a picture and explain what's it about. In the picture there are three codes that define the same procedure of finding the biggest number out of three given. The first code in the picture is defining a procedure called...
  25. N

    What are the areas of expertise for NumberSix?

    NumberSix solves problems using mathematics and mathematical software. He has worked on gesture recognition, speech recognition, video compression and several other highly mathematical areas. He has expertise in mathematical modeling, statistics, and linear algebra. He has many years of...
  26. S

    Plotting Density Parameters as a Function of Redshift

    I'm trying to plot the density parameters against redshift in Python, so I suppose this is kind of a cross over of programming and physics. I've been given the following two equations in order to do so $$r(z) = \lambda_H \int_{0}^{z} \frac{dz'}{E(z')}$$ $$E(z) = \frac{H(z)}{H_0} = \sqrt...
  27. doktorwho

    Python Which of these code editors would you recommend?

    Hi, I am looking to buy a code editor for my iphone so i can code on it. I don't know any of these but they are most if not all paid and i was thinking of asking for your help in choosing one of them. I would like it to be a python editor but it should also support other languages. It is also...
  28. doktorwho

    Why Does My Python URL Extraction Code Not Work?

    I am suppose to write a code that print put the url of a link given below. The url is defined to start where the first " appears and end where the last " url appears starting from the start_link. Its actually the last project from te lecture 1 in Udacity and the forst code of mine.. but its...
  29. doktorwho

    What is the best place to learn Python?

    What would be your option for learning python? Would it be a book a course a youtube channel.. you name it, whether paid or free it doesn't matter i just want to get an idea of the best place to start..
  30. G

    Programming an OldMaid Card Game python

    I am having trouble removing the same cards from my hand in my game of oldMaid. this is my source: Mod note: Added code tags to preserve indentation, and modified code slightly (replacing index i in arrays with j. deck=[] suits = ['\u2660', '\u2661', '\u2662', '\u2663'] ranks =...
  31. R

    Really simple Python program to simulate inelastic collision

    I'm trying to write this Python program that simulates a completely inelastic collision between two objects. The program seems to work for the most part, but I'm completely lost on the "heat released" part at the end. I have no idea if I'm calculating this right, or if I'm completely wrong. Can...
  32. sukalp

    About computers and being good at coding....

    i wanted to know how to become computer king of world if we have coding talent like making cool apps,software,making technical software machines like robotics. can we become computer king by challenging bill gates like what they did to world we can do in 1 day not by copying but following...
  33. FallArk

    Create a binary search tree in python with the support of variables

    My instructor asked us to create a binary search tree in python that supports variables. i.e. the tree will have variables inside, and the user can get the values for those variables by looking for the name of that variable. I don't really know how to implement this. What I have so far: class...
  34. sukalp

    C/C++ Question about learning C++ Linked Lists before Stacks....

    i wanted to ask you that in c++it is important we should learn linked list before learning stack,queue that i wanted to know while studying data structures
  35. FallArk

    Help with Python: Implementing Algorithm

    My instructor gave out a sample code as listed below: def eval_infix_sum(expr, pos): """evaluate a sum expression (zero or more additions and subtractions) expr Python string list complete expression to be evaluated pos integer...
  36. R

    Linux for Physicists: Best Distro for Beginners

    I am starting my PhD soon, and I want to properly start learning linux. I have mainly used windows for most of my life, but I have been apart of two research placements using linux mint, where I did simulations attaining to Nano-Photonics. I am curious as to if you guys have any opinion on the...
  37. Avatrin

    Exploring Algorithmic Composition and MIDI Programming with Python

    Python is the only programming language I know, and I know there is a huge library of MIDI music out there. I want to play around with machine learning and algorithmic composition to see what I can produce. So, what books should I read to be able to do this? What I am looking for is: Books to...
  38. MexChemE

    Python Learning Python: IDE or Not for Scientific Computing?

    Hello, PF! I've recently begun learning Python the hard way (you know, the online lessons by Zed Shaw), and so far I'm doing great. He does talk down to you at some times, but I don't mind that at all, and he encourages memorizing absurd things, but I like his minimalistic approach at...
  39. websterling

    Installing Python on Windows 7: Pip, Anaconda, 32-bit or 64-bit?

    I get to install Python on a Windows 7 box and have a few questions. In the past I always downloaded Python from python.org and added any additional packages either with pip or downloading and installing from the package's site. Is this the best way or would Anaconda (or something else) be a...
  40. GW150914

    Why wouldn't astronomers use Mathematica?

    Mathematica is fully functional for daily astronomy data analyzing works, and it is much more convenient than python, so why can't them use Mathematica instead of python? It's like when you have warp drive you still travel through space using chemically powered traditional rockets, which is...
  41. S

    Python Microcontroller: Learn How to Use It

    Hello, I ahve used C and C++ assembly lang introduction and few codes. which processor or microcontroller use phyton??
  42. sunrah

    CAMB python convergence power spectrum code

    I'm trying to understand this python CAMB code: http://camb.readthedocs.io/en/latest/CAMBdemo.html Scroll down to In[29] and In[30] to see it. It's an integration over chi (comoving distance), yet scipy.integrate.quad is not called. It seems that the fun stuff happens in the last for-loop in...
  43. nn2e11

    Python Doublet + Uniform Flow // Streamfunction Polar Plot Help

    Hello, Python,CFD and PF newbie here. I am using Spyder (Python 3.5) and I managed to plot my streamfunction in cartesian coordinates. I tried transforming and plotting in polar coordinates but I am not sure that what i have done is correct. I am not even sure what the plot should look like :/...
  44. ChrisVer

    What Is the Use of the Bitwise OR Operator in Python?

    With an example, can someone explain me what the following code would do? In fact I am not certain I understand how the |= operator is used. (I have checked for operator overloading within the classes but there is none, so it supposedly does the default operation) objectA = ClassA(arguments)...
  45. BiGyElLoWhAt

    Python Debugging the Swarzchild Metric - ValueError

    I'm messing around with the swarzchild metric, and I keep getting errors. First, it was a memory, which I could have guessed, 10000x10000 array, so I lowered it to 1000x1000 and it moves past that point, now. However, this is where I'm getting my error: Gravity = zeros([1000,1000]) while i <...
  46. S

    Python Why is my Hydrodynamics Simulation Code Producing a Noisy Signal?

    Hi! I have this code which should simulate a sod shock tube like this: https://en.wikipedia.org/wiki/Sod_shock_tube But when i plot density versus distance I just get something like a noisy signal. Any idea where I am doing something wrong? from matplotlib import pyplot as plt import numpy as...
  47. fluidistic

    MITx edx 6.00.2x python 2 code, need to fix a bug

    Hi people, I've "enrolled" into the edx MITx 6.00.2x course on python and data science, but I don't plan to get a certificate and I started so late that all the problems I'm facing aren't due anymore so I think this gives me the right to seek help here. Basically the task is to simulate some...
  48. DiracPool

    Problems installing Python modules

    I've installed Python 3.5.1 successfully, and I've downloaded add-on modules such as numpy, scipy, matplotlib, etc, but when I try to import them into python I get the following: "ImportError: No module named 'numpy'", etc. There's no executable file in the numpy download to activate anything...
  49. S

    Fit blackbody spectrum to data in python

    Hi! I have to fit a blackbody spectrum to some data points. The y-axis is in mJy and the x-axis is in log_10(freq). My code looks like this: from __future__ import division import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit h = 6.63*10**(-34) c =...
  50. BiGyElLoWhAt

    Solve Lambda Error in Python Homework

    Homework Statement Somewhat irrelevant, but we need to simulate the redshift for a star system. Pretty open ended. Single star, binary, whatever. The problem is this: TypeError: <lambda>() takes at most 1 argument (5 given) And upon searching, most people who get this error have a function that...
Back
Top