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...
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...
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...
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...
I'm revisiting python, because recently our physics department decided to adopt it as our computational language, and I missed the class. I've also been given the impression that it's a very good language for algorithms and what-not.
According to...
In c I quite often build header files with a bunch of predefined data. Fill it with structures or what not.
Then to include that information in my program its a simple #include "myHeader.h"
Is there a way I can do this in python?
I've created another file "myHeader.py"
Have put in some code to...
I very new to python and this might look relatively easy to some of you. I need to write a code so that
H(a,u) = \frac{a}{\pi} \int_{-\infty}^{\infty} \frac{e^{-y^2}}{a^2+(u-y)^2}dy
it plots the above function for different values of the a parameter, so that ultimately i will have a graph of...
So I am fairly new to Python and feel somewhat comfortable with it. I am trying to do something what I think seems kind of simple however am not too experienced with loading files into Python (or any programming language for that matter).
What I am trying to do is I have csv files that contain...
Homework Statement
I have to make a program that would end when entered a 0 and print out negative numbers and even numbers separately but what I have so far is not working.
The Attempt at a Solution
numbers = []
negative_numbers = []
while True:
number = input("Enter a number: ")...
Hi I am currently trying to find the water absorption lines by using a Michelson interferometer, as a detector I am using an ocean spectrometer. The data obtained is thus the spectrum's "received" by the spectrometer. Am I right to assume that in order to find the absorption peak/peaks I should...
Homework Statement
I'm currently working on a project in which I have to solve the energy eigenvalues of the Schrodinger equation to compute the mass of certain Mesons. We've been taught very little programming (so apologies that my understanding is very basic), and are therefore given any...
Homework Statement
I made a two-dimensional array program, but now I need some help to alter the program in the print zone.
The Attempt at a Solution
import sys
students = []
grades = []
while True:
student = input ("Enter a name: ").replace(" ","")
if...
Homework Statement
So, I have a program, which I am finishing but I apparently ran into a problem. In the program I have to make that whenever I enter a 0 in the input, the program will stop and print the results. Here's the program before I continue saying anything else:
The Attempt at a...
I've looked around for this and so far haven't found anything close enough to what I'm after.
In matplotlib, I want to get a specific tick on the x-axis to label a particular value. I know how to use axvline to get a vertical line marking that point, which is good, and I know how to add...
Homework Statement
I need a program, which would break and show results once a 0 is entered in input name and input grade.
I figured how to do that in name, but how do I add another break? Like grade !="0"?
Homework EquationsThe Attempt at a Solution
students = []
grades = []
while True...
Homework Statement
I made a program that would some up a grade average. Everything seems fine, the only problem, when I run the program at the end it prints out like this:
Jack
5
10
6
7.0
Stacy
10
8
9
9.0
Jack
5
10
6
7.0
Stacy
10
8
9
9.0
Jack
5
10
6
7.0
Stacy
10
8
9
9.0
How can I make the...
Homework Statement
I need a program where the program needs to ask me a name of a student and then a grade.
1) The program needs to end if a 0 is entered.
2) If the name has a number in it, the program should ask the user to enter another name.
3) After the name is correctly entered the program...
Homework Statement
I need a program (in PYTHON), which would ask a user his name and grade, then print them both. 1) If the name has a number it, the program has to ask the same question again until the name is entered correctly 2) The same with the grade. If it's higher than 10, the program...
Homework Statement
So, I start off with initial condition:
\psi(x,0) = e^{\frac{-(x-x_0)^2}{4a^2}}e^{ilx}
This wavepacket is going to move from x_0 = -5pm towards a potential barrier which is 1 MeV from x = 0 to x = 0.25 pm, and 0 everywhere else.
a = 1 pm
l = 2 pm-1
Homework Equations
I...
Homework Statement
I need to write a Python program, which would:
1) Ask for a name (input function)
2) Keep asking for the name if it is not entered correctly(if it has a digit in it)
3) If the name is entered correctly it will print the name
Homework Equations
How should I continue the...
I am self learning Python and developing Communication signals concept by coding programs.
But I am not sure how to develop Eye Diagram code in Python - cause I do not know the formulas / concept to do so - say I have a signal bits like -
1 1 1 0 0 0 1 1
So what formulas of concept I should...
I really need help with a big Python program. Our professor has been MIA for the whole term and now we need to submit a program. I thought I was doing and learning fine on my own, but the program simply does not work for me.
I need it till Thursday and I am ripping my hair out because I cannot...
global m_mu = 106.0
global M_Z = 91200.0
global a = 1.0/128.0
global theta_w = asin(sqrt(0.23152))
global g_e = sqrt(4*pi*a)
global g_Z = g_e/(cos(theta_w)*sin(theta_w))
I have written this code in Python 2.7 using Enthought Canopy, and each line throws up a syntax error, but I have no idea...
I have previously learned C and Python. I'm just starting out with Ruby and Scala. But I need to become more proficient in these languages, so could someone suggest good sources of problems/exercises in each of these languages
sources could include websites, books, etc.
So I am in my Intro to CS course and they are going over Binary searches via an algorithm to search for simple things. The code goes as this:
Set first to 0
Set last to length-1
Set found to FALSE
WHILE (first <= last AND NOT found)
Set middle to (first+last)/2
IF...
Hey, sorry if this is not the right section to post in, the topic is a bit ambiguous.
I've generated a set of coordinate points for the orbit of Mercury (3d cartesian) and now I want to fit an ellipse through it so I can get an accurate estimate of the location of the perihelion. I am using...
So I am going to be making some keys; and I want to make them more random... So I made this:
#I know that the code is pretty crude, but it works.
#P.S. it is an infinite loop, run at your own risk
import random
from random import randint
import string
import time
x=1
n=randint(5,90)...
Homework Statement
A python can detect thermal radiation with intensity greater than .60 W/m2. A typical human body has a surface area of 1.8 m2, a surface temperature of 30°C, and an emissivity e=0.97 at infrared wavelengths. What is the maximum distance from which a python can detect your...
Homework Statement
My professor wants us to program on Python, where we have a certain sequence, for example:
sequence = ("one", "two", "three", "four")
I need to replace one of the sequence elements (example: "one") with another element (example: instead of the word "one", I need to put...
Do anyone know of a good detailed book or website that would help me learn Python quickly? I have assignments that must be done in Python for one of my physics courses.
I'm supposed to know how to do it since last semester but had a greater deal of trouble picking up on it and didn't have much...
I'm looking for a textbook on computational physics based on python. For now I have found Computational Physics with Python by Mark Newman, which I am trying to evaluate. If you have experience with this book or a similar book, I would like to hear from you. (And only if you have knowledge...
Hello,ALL
Have somebody used python to Instanciate UDF in CATIA ?
I have some question with it
As follows:
Traceback (most recent call last):
File "D:/VSProjects/Python/instantiateTemplate/insTemplateDlg.py", line 80, in on_buttonApply_clicked...
I have a book for learning python that teaches it with python3 in mind. I also have been using codecademy.com to learn in a more structured way. The thing is that codecademy teaches python from when the most recent form of python was 2.7.3. Their reasoning behind this is that python3 isn't very...
Hi everyone,
I am a High School student (final year) and am doing an extra-curricular project. Having complete autonomy on what we do the project on, I choose to design a High-Altitude Long-Endurance (HALE) UAV, such as the QinetiQ Zephyr [http://www.airforce-technology.com/projects/zephyr/] or...
Hello, i want to start learning python, but i can't install it after i download python3.4.2 from python's site..then i don't know what to do...it's complicated cause i 've never occupied with programming and it seems hard for me, i'd really appreciate your help
I'm a first year physics student, and one of my assignment for my programming class is about percolation. I need to create some disks randomly distributed in an area (this is a 2-D), and then by varying the density of the disk, I need to figure out the percolation threshold such that the two...
Homework Statement
This is just a project for fun, not homework.
I'm writing something in python that takes in an apple's initial position vector and initial velocity vector, and for a given gravitational field due to a planet, returns the next position vector after a small time increment...
Homework Statement
As a string in my program.
Homework Equations
Solving a system with the forward phase of row echelon reduction and a consecutive back substitution.
All done by numpy here. (The book suggested MATLAB, etc).
The Attempt at a Solution
import numpy
""" In a wind tunnel...
What am I trying to do? I'm trying to implement a simulation of a chaotic billiard system, following the algorithm in this excerpt.
How am I trying it? Using numpy and matplotlib, I implemented the following code
What is the problem? When calculating phi_new, the equation has two solutions...
Homework Statement
What I'm trying to achieve is an advection equation that will run using 3 variables. I must confess I don't have a great grasp over this part of my course. Its pretty complicated!
Homework Equations
The code I have at the moment is:
def SolveAdvectionEquation(a, b, t0...
Homework Statement
I have the following code (please see below). I want it to return [2,4,6,8,10] which is the function evaluated at the given list [1,2,3,4,5]. I want to do this using the process command.
My problem is:
print A returns
[None, None, None, None, None]
But I want it to return...
Hello all,
Well, I am on my master project named 'General Relativity & Gravitational Waves'. My supervisor asked me if you can simulate gravitational waves by programming it would be a plus. But only programming language I am currently learning is python. Is it possible to simulate some kind of...
I downloaded a script for python and have no idea how to run it.
Do I go into the python GUI or the windows command prompt? Is there any way I can use this in github?
Someone told me on another forum said the following.
1. cd /path/to/file
2. python script.py <options here>
Which commands do...
I am trying to model an FPGA FM radio demodulator in Python. I will have a mixer that converts an FM channel to 36MHz IF, and I plan on undersampling this IF signal. If in the digital world (my Python model), I have a high sample rate FM signal at 1.2MHz, should I be able to resample to a...
Homework Statement
You're going to create some medical diagnoses software. You are going to ask the user if they have a fever, a rash, if they have a stuffy nose, and if their ear hurts, and give one of the following responses:
Don't have a fever and don't have a stuffy nose: Hypochondriac...
I have am learning python nowadays. I want to learn C# as well. But I fear that I may forget some things of python if I learn C#. I would like to know, from real programmers how you learn all types of programming languages and still remember them.
I still haven't learned much python. Just...
Here is a python function to check whether a given list or string contains duplicate values:
def has_duplicates(x):
t = []
for i in x:
if i not in t:
t.append(i)
if t != list(x):
return True
else:
return False
But I am sure this approach will be slow for...
I am experimenting with capatcha images. I have a capatcha.php in my local host which will generate an image and that image will be put into the form
Here is my python code to get the image, extract the text in it and send them back to the form. And finally save the resulting form as html...
Hi,
My aim is to get a series of images in 2D space that run over different timestamps and put them through a 3D Fourier Transform. So my 3D FT has 2 spatial axes and one temporal axis. However I have never done anything like this before, and I have a very basic knowledge of Python.
So...