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...
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...
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...
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))...
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...
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...
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...
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...
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]...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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))...
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.
#...
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...
# 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...
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...
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...
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...
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...
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...
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...
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...
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..
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 =...
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...
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...
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...
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
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...
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...
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...
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...
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...
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...
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...
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 :/...