For mathematical questions about Python; questions purely about the language, syntax, or runtime errors are off-topic here and would likely be better received on Stack Overflow.
Questions tagged [python]
952 questions
0
votes
1 answer
AUC from a single precision and recall value?
I found the below post to provide an answer for calculating AUC value for a single TPR and FPR.
How do I compute “AUC” Area under the curve number, if all I have are my TPR and FPR values?
Is it also possible to calculate AUC from a single Precision…
Ina
- 1
0
votes
1 answer
How can I return a list having the following sum v[i]=A[i,2i]+A[i,2i+1]
A is a matrix of size nx2n ,and I'm trying to write a Python code that will return the list v without using a for loop using numpy functions.
user3133165
- 785
0
votes
1 answer
Please help with context on this math equation for a Python application
I'm not requesting a solution... I simply do not understand what this instructor is requesting with this assignment.
"Light travels at 3 * 108 meters per second. A light-year is the distance a light beam travels in one year. Write a
program that…
jc allen
- 103
- 2
0
votes
2 answers
How can I type this into a calculator?
In a textbook I am asked to calculate an expression using a calculator: $$\frac{1}{2}\ln\left(e^{22}\right)$$
I tried using:
0.5*log(exp**22)
This returned an error:
File…
Doug Fir
- 2,266
0
votes
1 answer
What is the difference between the following two tests: w.isupper () and not w.islower ()?
It's a question at the crossroads between computing and set theory
I just immersed myself in the Python documentation to answer this question
Let say $w$ is a string. What is the difference between the following two tests: w.isupper () and not…
Revolucion for Monica
- 1,511
0
votes
1 answer
Function to rotate on a 3D sphere at a fixed distance?
Is there a single function or a set of functions that takes two points in 3d space, calculates the distance, and rotates a given radians or degrees?
[example: a plane flies around the equator of a planet, while the planet wobbles relative to the…
0
votes
0 answers
Creating a circle point by point
I want to create an array of points that has equal distance to some center coordinate.
It will be like, give to the function center longitude, center latitude, radius of the circle and number of points, then it creates that many points from the…
mustaphos
- 33
0
votes
1 answer
Python cycle to math formula
There is some code snippet written on python:
number = 5602004
accum = 0
while number:
accum += (3 * (number % 10))
number = int(number / 10)
accum += (number % 10)
number = int(number / 10)
So, cycle is working while variable…
Roman Banakh
- 13
- 4
0
votes
1 answer
add and remove an element to a mathematical set
I'd like to write pseudo code with mathematical notation, I will write the code phrases in Python. I need to know if
first question:
aList = []
aList.empty() is not True
equals
$aList \neq \emptyset $
second question
a =…
user3085931
- 113
-1
votes
1 answer
is there a way to output a square root in a square root form instead of a read number with python?
there are a lot of tools could be used to compute square roots.
for instance, with Python NumPy
np.sqrt(80)
outputs
8.94427190999916
is there a way (or a 3rd party package) to have
sqrt(80)
output
$4\sqrt{5}$
soplus2018
- 82
-1
votes
4 answers
coding in python that it sums a number that the user will give
i want to make a python program that ask from the user a number and the program should sums up the first n squares as long as the sum is smaller (not smaller than or equal to) than the numb er that the user has choose before
Like this line
1+2**2…
UX373
- 11
-1
votes
1 answer
How to export the output to excel sheet in python 3?
I have the following python code which gives two sets of numerical results. I want to use the output for my computation. After each code run I copy the output manually to excel sheet that takes a lot of time. I want to export the numerical values…
Litun
- 670
-1
votes
1 answer
Similarity of unitary matrix
How to check if two 2x2 unitary matrices are similar using python..Is there a speacial function for it
Debarghya Kundu
- 11
- 4
-1
votes
1 answer
python code for for mathematics graph
wrote some Python code to plot the coordinates of simple one dimensional linear mapping using matplotlib
Can someone tell me what's wrong with my code?
import matplotlib.pyplot as plt
import numpy as np
result = [10]
result[0] = 1
a = 1.1
x =…
S.Ky
- 177
-2
votes
1 answer
Python: Difference Between Two Uses of np.append
I'm not sure how to explain why I want to do this but...why does this code
x = np.array([1,2,3,4])
d = np.empty((0, 4))
d = np.append(d,[x],axis=0)
x[0]=8
d = np.append(d,[x],axis=0)
give me this
array([[ 1., 2., 3., 4.],
[ 8., 2., 3., …
Rubarb
- 555