Python Definition and 662 Threads

  1. C

    Python Simple Python Database Tutorial & Example

    Can anyone refer me to a tutorial or example Python database progam? I'm trying to understand how one might create and manipulate a simple/small database such as a file containing names, addresses, and phone numbers. I've spent an hour or two searching and keep finding references to SQL and or...
  2. S

    Python Security alert for python libraries

    This security alert http://www.nbu.gov.sk/skcsirt-sa-20170909-pypi/ warns against fake python libraries: containing "malicious (but relatively benign) code".
  3. M

    LaTeX Printing Code from Python in Latex via "minted"

    Hi PF! I am trying to import code written in Python into Latex via the "minted" package. However, I am getting the error: Package minted error: you must invoke latex with the -shell-escape flag. I tried googling help but I can't figure it out. I'm using Python 2.7 on mac OSX sierra. Any help...
  4. Hercuflea

    Python Insert data into excel, calculate+retrieve data using Python

    Hello, I currently have a Google Sheets document that I want to run some analysis on. The document is very formula- heavy (not just raw data). It takes a set of input numbers and does some computations and gives me an important output number at the bottom of the spreadsheet. These computations...
  5. ShaddollDa9u

    Python Why am I getting 'nope' instead of 'works' when using sockets in Python?

    Hi everyone, I have just started learning sockets in python and I have made the following code: import socket HOST = '' PORT = 8888 def main(): while 1: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT))...
  6. franciobr

    Python Python workflow for experimental data analysis

    Hello! I have been using python for my data analysis and processing needs as an experimental physicist for an year now. I have used MATLAB and originpro before and python provides me everything I need. But I am not satisfacted with my worflow specifically for plotting needs. I often find myself...
  7. olgerm

    Python Making my web page publicly available

    I want to make a web page. I made it work in local network using python and Flask module. It also saves and uses data in responses, that it has got by GET and POST requests. What should I do to make it publicly available so that I had to change the original script with flask as little as...
  8. O

    C/C++ 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...
  9. A

    Python 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...
  10. Jamison Lahman

    Python 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]...
  11. maajdl

    Python 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...
  12. 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...
  13. Jamison Lahman

    Python 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...
  14. 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...
  15. S

    Python 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...
  16. 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...
  17. 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...
  18. arnazkh

    Python 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...
  19. 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...
  20. L

    Python 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...
  21. FallenApple

    Python 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...
  22. 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
  23. 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...
  24. S

    Python 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...
  25. 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))...
  26. 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. #...
  27. 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...
  28. 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...
  29. 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...
  30. 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...
  31. 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...
  32. 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...
  33. 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...
  34. 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...
  35. 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...
  36. doktorwho

    Python 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..
  37. G

    Python 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 =...
  38. R

    Python 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...
  39. 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...
  40. FallArk

    Python 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...
  41. 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
  42. FallArk

    Python 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...
  43. 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...
  44. Avatrin

    Python 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...
  45. 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...
  46. websterling

    Python 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...
  47. 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...
  48. S

    Python 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??
  49. sunrah

    Python 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...
  50. 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 :/...
Back
Top