I am currently working my way through some w3schools python exercise on tuples and lists etc and one question was to write a program to converted a tuple to a string.
Now originally I used the str() function on the tuple and printed the result. I then used the string in a for loop for a...
I’ve been looking for a certain type of software that can host programming (preferably C or Python) and other process that I’m going to need such as DSP, DSP filters, diagrams (3D graphs, charts,…), and text editing within the same file. It’s mainly so that I can incorporate and use each one...
I'm interested in quantum programming. So far I've managed to use Java and Python inside Datamelt computation project for physics simulations and for various statistical plots. Now I want to make a simple code that illustates quantum computing, and maybe even to visualize its principles (for...
I am trying to animate a plot of two distinct points (blue and green points) moving about the complex unit circle using Python's Matplotlib library. The problem I am having is that the animation does not remove and update the previous data points but rather sequentially smears it on the unit...
Hey everyone!
This might be a bit of a dumb question, but I'm not familiar with much in the programming world. I know a few languages that I've learnt on my own (online) or through a course in school (MATLAB). When it comes down to coding outside of matlab or a website, I'm not sure where to...
Hi, I want to plot the vector field ##\vec F = ye^x \hat i + (x^2 + e^x) \hat j + z^2e^z \hat k##
The code I have tried:
# The components of the vector field
F_x = y*e**x
F_y = x**2 + e**x
F_z = z**2*e**z
# The grid
xf = np.linspace(-0.15, 2.25, 8)
yf = np.linspace(-0.15, 2.25, 8)
zf =...
Hi,
I want to program an GARCH model for exchange rates. To do this, I calculated the residuals. Next, I did the following (in python)
def main():
vP0 = (0.1, 0.05, 0.92)
a = minimize(garch_loglike, vP0, eps, bounds = ((0.0001, None), (0.0001, None), (0.0001, None))...
I want to make an animation where a (red) ball departs from (0,0) and draws the function ##f(x) = sin x##
This is what I know:
How to plot ##f(x) = sin x##
To do so I followed instructions from the worksheet. Actually I'd have done:
But I guess they want to me to it in that way because...
I asked this question on SO, but I am having problems with it (I cannot even get into my account now). It seems that people using the IP I am using are asking a lot and that limits the number of questions I can ask. Please have a look at my question. Here's the link:
[Moderators note: bold large...
Two weeks ago I had no idea on how to code using Python. Now I have completed an online course on functions, loops and strings. However, in that course I did not practice using the specific library called Sympy. Besides, I will use Python in the Physics-Math background, for solving problems like...
I am looking for a book for learning Python so as to compute matrices, eigenvalues, eigenvectors, divergence, curl (i.e vector calculus).
If you also have online recommendations please feel free to write them.
In the following example, there are three time series and I want to predict another time series y which is a function of the three. How can I use four inputs to predict the time series where the fourth input is the output at previous time step?
import tensorflow as tf
import numpy as np...
In Keras, the method model.fit() is used to train the neural network. How can I get the output from any hidden layer during training? Consider following code where neural network is trained to add two time series
#multivariate data preparation
#multivariate multiple input cnn example
from numpy...
This is not a question, but a note, which I thought could help students.
I thought I would share this here, as people may be looking for practice problems.
My professor in the Python course I just finished recommended https://projecteuler.net/ as a site to practice using programming skills...
Dear Sirs,
I have a signal which has an attenuation of 20dB per decade, how do I remove this attenuation using SCIPY? Alternatively how to do it in MATLAB if there are no SCIPY users here?
I'm a SCIPY/MATLAB novice fyg.
Thank you for your kind assistance
Abim
Well I think it is cool anyhow ;)
Here is a dependency-free variable-order double pendulum simulation in about 120 lines of Python. Have you seen the equations of motion for this system?
As usual, this is based on code that I have provided here, but trimmed for maximum impact. Can you see...
I have a few of integration equations and need to convert it into Python. The problem is when I tried to plot a graph according to the equation, some of the plot is not same with the original one.
The first equation is the error probability of authentication in normal operation:
cond equation...
1. Homework Statement
This problem is from Mark Newman's Computational Physics, problem 7.9, found at
http://www-personal.umich.edu/~mejn/cp/exercises.html. The problem gives us a blurry convolved image, according to a Gaussian point spread function and our objective is to deconvolve it to...
I have several equations and need to convert it into Python. The problem is that I tried to plot a graph according to the equation. However, the graph that I get is not the same as the original one.
In the paper, the equation of error probability for MIM attack is given by:
First Image
Second...
So I tried solving the differential equation for a spring - mass system using Euler's Algorithm in Python. The equation being
d2x/dt2= -4π2x
(The equation was obtained by Dimensional Analysis)
here x and t are both dimensionless equivalents of position...
I want to write a python program to calculate the Kirkwood−Buff Integrals.
The equation is as:
G=4π∫0 ∞ r 2 [g(r)-1] dr
I have the g(r) values.
Any suggestions are highly appreciated.
Thank you.
1. Homework Statement
I have a project to make the Solar system on Python, which I have done, but they also require from us to calculate the total energy of the system. We don't have to make the orbits of the planets elliptical, they should be circular and I believe I made them like that. Since...
I have a project to make the solar system. I am trying to start from somwhere. On the notes it says that we need to start by creating a System of Particles
Two-body simulation (Circular motion)
Implement Gravitational acceleration
Each particle (planet) could have its own field.
I.e. Each...
The Earth's magnetic field is cylindrically symmetric and can be described using cylindrical coordinates, (ρ,z,φ). The components of the magnetic field are given by:
(B_φ) = 0
(B_ρ) = −∂A/∂z,
(B_z) =(1/ρ) * ∂(ρA)/∂ρ.
The vector potential for a dipole field is given by
(A_φ) = (B_e)(ρ) *...
I had recently upgraded my version of python from 2 to 3. I had a program that encrypted a text file by converting a character to its Unicode value, altering it and then changing it back to a character using the ord() and chr() methods. This does not seem to work with python 3 and I was...
I am trying to drop the series size so that it matches the size of the dataframe as I need to copy the index value of the series into the df but I am getting mismatch errors. df has a size of 100 but time has a size of 200 so I want to remove the extra rows in time to match df. how can i handle...
I have a dataframe that looks as attached. What I aiming to do is to plot the lines for each type where if it is for type A, I want to be able to have two lines in the graph that shows the trend for type A. I was not able to find any examples online especially with the format of the data in this...
Goal:
I'm trying to allow the user to input varying spellings for certain auto services, and still have my code work properly. My goal was to use the if-else statements to ensure that if the user misspelled a service, the code could correct the error by changing the variable assignment to the...