math

lists are accounting for nothing as a similarity?

lists are accounting for nothing as a similarity? Question: I’m trying to find matches in 2 parts of a string of numbers, my input, "ref4" is: Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53 Card 2: 13 32 20 16 61 | 61 30 68 82 17 …

Total answers: 1

Direction vector: Correctly scale sin(radians(x)) + cos(radians(z)) with y axis

Direction vector: Correctly scale sin(radians(x)) + cos(radians(z)) with y axis Question: I have an issue with the directional transform math for a voxel raytracer I’m working on in Python. X axis is left-right, Y axis is up-down, Z axis is forward-backward: I calculate view direction from a camera angle stored in degrees, direction being the …

Total answers: 1

Integration by Trigonometric Substitution using Sympy

Integration by Trigonometric Substitution using Sympy Question: I am learning integration by trigonometric substitution and want to perform this using sympy, but am having trouble with differential manipulation and applying the boundary conditions after back-substitution. I am trying to emulate this logic using the Python module Sympy: Here is the code I have so far: …

Total answers: 1

using python to get to a value with only known numbers

using python to get to a value with only known numbers Question: let’s say I have only have 2 known numbers, 1500 & 1000 and I want to figure out how many of each I need to add to get to 4000. what would be the most efficient way to code that? Asked By: Jayme …

Total answers: 3

Numbers of combinations modulo m, efficiently

Numbers of combinations modulo m, efficiently Question: First of all I’m solving a programming problem rather than a math problem now. The question is Anish got an unbiased coin and he tossed it n times and he asked Gourabh to count all the number of possible outcomes with j heads, for all j from 0 …

Total answers: 3

What is the problem with my code for finding whether a number is prime or not

What is the problem with my code for finding whether a number is prime or not Question: N = int(input()) flag = False if N <= 2: print(‘no’) for j in range(2, int(N**0.5)+1): if N%j == 0: flag = True if flag == False: print(‘yes’) else: print(‘no’) The logic is same everywhere I saw the …

Total answers: 2

Calculate atanh with numbers very close to 1

Calculate atanh with numbers very close to 1 Question: I need to calculate the inverse hyperbolic tangent with great precision. The equation in question is -atanh(1/ (1 + 10**-x)) where x should be on the order of 240 and return the approximate value of -276.65. I tried some libraries that python provides, like numpy, math …

Total answers: 1

The max recursion for the coefficient of a polynomial

The max recursion for the coefficient of a polynomial Question: Recently, I came across an interesting counting problem on YouTube posed by 3Blue1Brown-OlympiadLevelCounting. The problem is to find the number of subsets of the set {1, 2, …, 2000} whose elements’ sum is divisible by five. Grant Sanderson presented a beautiful solution, but he also …

Total answers: 2

Find all possible sums of the combinations of integers from a set, efficiently

Find all possible sums of the combinations of integers from a set, efficiently Question: Given an integer n, and an array a of x random positive integers, I would like to find all possible sums of the combinations with replacement (n out of x) that can be drawn from this array. For example: n = …

Total answers: 1