# python

1. ### Complex verses Quaternion Question

In Python, complex numbers are typed as follows: 3+4j. This kinda bugs me that they use "j" instead of the traditional "i", particularly because quaternions (4-dimensional complex numbers) use i, j, and k for the three "imaginary" directions, so this would cause some overlap. But then I got to...
2. ### SciPy Objective Function

Hello all I need to use SciPy's minimisation functions to solve a problem, but I don't know which one to use. At the moment I'm just using SciPy.optimize.minimize (because it was the simplest for me to implement) but there may be a better solution. The problem is that I have three distinct...
3. ### Python nth prime

I have only been using Python for a few days. I am trying to write a code in Python to calculate the nth prime number. However, I don't know how to start. The only thing I have written is: def nthPrime(n): I need some help on what to do next.
4. ### How to program this in matlab or python: matrices

We are looking at a square in the uv-plane, that we have divided into 10 smaller squares. This means that the large square consists of (10+1)^2 = 121 corners (i,j). We have a vector, x = (x_1, x_2, ... x_k, ..., x_{121}) = (f(0,0), f(1,0),...,...f(10,10))) where x_k = f(i,j), where k =...
5. ### Invalid syntax in Python

Can someone tell me what the syntax error in this program is? The program attempts to check a list for duplicates and return True if it has any, False if it has none. def dupl(L): ----if len(L) <= 1: --------return False ----elif L[0] in L[1:]...
6. ### Recurrence relations in Python

I am trying to make a program in Python to find the solutions for for x_n in a recurrence relation. The recurrence relation is: x_{n+2} - 3x_{n+1} + x_{n} = 0 with x_{0} = 1, x_{1} = \frac{3-sqrt(5)}{2} Which means that: x_{n+2} = 3x_{n+1} - x_{n} = 0 Solving this gives the answer...
7. ### python - Fibonacci Sequence

Hi, Im very confused about this question concerning the Fibonacci sequence: Implement an iterative Python function to generate numbers in the Fibonacci sequence: fib(0) = 1 fib(1) = 1...
8. ### Python - Repetition (Iteration)

Convert the following while loop into for loops and the for loops into while loops. *