11 questions
0
votes
0
answers
69
views
Strange black borders on count changes with cmath on my python fractal render
I recently wrote a program which renders the mandelbrot set and encountered some irrelevent issues, which some helpful users solved for me. One user reccommended I change an aspect of my code for ...
0
votes
3
answers
561
views
How do I express the math equation i + e^(i * pi) in Python?
The expression I am interested in:
It mentions I have to use cmath modules for the equation.
so far I've tried
ans = cmath.sqrt(-1j) + (cmath.e ** (cmath.pi * cmath.sqrt(-1j)))
Is putting j after the ...
1
vote
1
answer
161
views
Is there a difference between math.inf and cmath.inf in Python?
Is there any difference between the infinities returned by the math module and cmath module?
Does the complex infinity have an imaginary component of 0?
0
votes
1
answer
221
views
Count the number of complex, real and pure imaginary numbers in a numpy matrix
Given a Numpy array/matrix, what is pythonic way to count the number of complex, pure real and pure imaginary number:
[[ 1. +0.j 1. +0.j 1. +0.j 1. +0.j 1. +0.j ]
[ 1. +...
1
vote
2
answers
862
views
Can cmath.sqrt be applied to a NumPy array?
I want to calculate the square root of a numpy array of negative numbers.
I tried with np.sqrt() but it gives error beacuse the domain.
Then, I found that for complex numbers you can use cmath.sqrt(x) ...
-1
votes
3
answers
119
views
Python Complex Number Operations
I have an equation
(0.125-(1j*(mu1)*0.125))/(0.125 - cmath.sqrt((0.125**2)-(0.125**2)-((mu1**2)*(0.125**2))))
This is suppose to be 1 for any value of mu1 but it seems I am getting 1 only if mu1 is ...
0
votes
1
answer
1k
views
Generating Numpy Arrays of Complex Numbers
How can I quickly generate a numpy array of calculated complex numbers? By which I mean, the imaginary component is calculated from an array of values.
I have tried using python's literal j without ...
1
vote
2
answers
154
views
The values of a vector in python are shown as nan value [duplicate]
I have a vector y with size, for example, (1,64). I create a vector in python as follows:
vec = np.pi * np.sqrt(-1) * range(len(y))
I get the output values of the vector vec are all nan or the ...
-1
votes
1
answer
176
views
Inserting complex functions in a python code
I have been trying to insert $e^ix$ as matrix element.
The main aim is to find the eigenvalue of a matrix which has many complex functions as elements. Can anyone help me how to insert it? My failed ...
2
votes
2
answers
2k
views
Multiplying a float Number to a Function in Python and getting can't multiply sequence by non-int of type 'float'
I have the following code written in python 2.7.
Here I've defined two function, a cosine function and an exponential function
and I need to multiply these functions to a float Value, but I am getting ...
0
votes
2
answers
578
views
Quadratic formula: python treating floats as strings
I am making a program that asks the user to input values for a, b and c which are then used to compute the roots using the quadratic formula. The only problem I have is that python treats a and the ...