Questions tagged [math]

Math involves the manipulation of numbers within a program. For general math questions, please ask on math.stackexchange.com. Note: If your question is about unexpected results in floating point calculations, please read https://stackoverflow.com/questions/588004/is-floating-point-math-broken first.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

Minimum and maximum number of outputs of F-1(

Given any element y in Y What is the minimum and maximum number of outputs of F-1(y) (min,max) a. (0,1) b. (1,1) c. (1,2) d. (∞,∞) What is the reason why the answer is (1,1) why 1 as minimum and why 1 ...
Trigo Brooken's user avatar
2 votes
2 answers
111 views

Problem execute calculations in a nested loop. TypeError: 'numpy.float64' object is not iterable

I'm trying to calculate the sum of squared errors and i'm using a nested loop. I'm new to Python and i apologize, but i encounter the error: File "...", line 13, in <module> for ...
Nodigap's user avatar
  • 21
-3 votes
2 answers
66 views

`min()` is not working properly in Python?

I am new to Python and notice the following error when using min(). import pandas as pd a = [1,2,3,4,5] print(min(20, pd.array(a)**2)) The code should return[1, 4, 9, 16, 20], however, it returns [1, ...
Yang Yang's user avatar
  • 896
-2 votes
1 answer
42 views

CS50 More-Filters (Blur) Debugging help, I'm completely stuck

So I made every other project myself and asking only for help Chatgpt because I asked whats wrong (and without solving it) he hinted me the problems and I fixed it while asking and learning about the ...
Dev Tusi_1's user avatar
0 votes
0 answers
17 views

How to fix the graph of a function?

restart; N := 100; h := 10/N; xi := Vector(N+1); for i to N+1 do xi[i] := (i-1)*h end do; X := proc (x) options operator, arrow; 8*sqrt(x) end proc; Xi :...
Andrij Matviiv's user avatar
0 votes
0 answers
22 views

perspective divide and clipping

EDIT: Restated question. If you look at the first image in this original question, the problem might be restated as: "what coordinates of the image are at the corners of the axis-aligned bounding ...
user1643428's user avatar
0 votes
0 answers
37 views

C the output of `harga` after `kartu_member_kode_diskon` = Rp 0.00 where did i do wrong?? + revise this code please

im trying to make hotel reservations online program on c but i encounter a few problem like the price(harga) is equal to zero. i know i should've used file instead on pilih_kamar_pojok_atau_engga1 but ...
XI MIPA 1 MICHAEL ELBERT JUSTI's user avatar
-1 votes
0 answers
44 views

Optimizing complex mathematical expressions in python [closed]

Suppose I want to write a python function to evaluate the following expression, Here is my script, import math def Roch_Alegra(u,v,p_1,p_2): expression= math.exp(1-((((1-math.log(u))**p_1-1)**p_2+...
User's user avatar
  • 25
-3 votes
0 answers
54 views

Take user input and compute the math expression [closed]

I want to convert a user input for example "2 * 3 + 5 - 62 / 4" into a runnable java math expression. However it doesn't respect order of operations or multiple operators (such as "2 * ...
star.rei's user avatar
1 vote
1 answer
25 views

How to make a function that calculates a chance of input based on some factors

I am currently in the process of creating a game in python, which is basically the same as the game "The Button" on steam. Whenever you click, there is an n% chance of resetting back down to ...
GeoKay's user avatar
  • 11
-1 votes
1 answer
57 views

how to connect two intervals?

wells = [ [ [0, 0.4, 'pop'], [0.4, 1.2, 'sup'], [1.2, 2.4, 'gal'], [2.4, 3.2, 'grav40'], [3.2, 4, 'buz'] ], [ [0, 0.4, 'pop'], [0.4, ...
Tommy Vercetti's user avatar
-1 votes
3 answers
67 views

How to find the rounded value of 0.00037878768

I want to calculate some percentage that is creating values 0.0034657, 0.000002376876868, 0.00004557600 etc. like this bt in my react project i want to round the ablove values and print those values 0....
Nikhil Jikar's user avatar
0 votes
1 answer
31 views

Detect Specific Error Description in Python

Not sure if it's possible, but I'm wondering if I can get the "specific" error. I can get an error through print(ERROR.__name__) and this would return "ZeroDivisionError", but the ...
xyz's user avatar
  • 61
0 votes
1 answer
27 views

Maple 2023 plot() function is working very strange with composite functions. Am I doing something wrong?

I am trying to make a period function which is oscilating between 1 and 0. I made a function which is oscilating how i need on an interval <0,7), when i tried to make it periodical i wrote a ...
chons's user avatar
  • 1
-4 votes
0 answers
25 views

Title: "Optimizing Quantum Entanglement: Can Quantum Superposition Be Leveraged for More Efficient Code Execution? [closed]

This question delves into the intersection of quantum computing and software optimization, exploring the potential use of quantum superposition to enhance the efficiency of code execution. This unique ...
Aalim Baba's user avatar
-1 votes
0 answers
22 views

Cubic B-Spline curve with multi-control-points segment

my problem is quite similar to this one. If I have a uniform clamped cubic B-Spline curve with multi-control-points (e.g 6 control points from P0 to P5), how could I get the new 6 control points that ...
Misaka's user avatar
  • 1
0 votes
2 answers
40 views

Can I assume that a 64 bit number is the pruduct of two 32 bit numbers?

I am trying to make a brute force program to guess and check numbers until I find two unknown prime numbers that multiply to a known number. But when the known number is 64 bits long its inefficient ...
Mathias Hauvgaard's user avatar
-1 votes
0 answers
9 views

Componentwise product in complex numbers

I want to prove that we can't express u1u2+iv1v2 with addition, subtraction, multiplication operations on z1=u1+iv1,z2=u2+iv2 I tried to prove it, but it doesnt work. If we introduce conjugate ...
Wjsjdj's user avatar
  • 1
0 votes
1 answer
30 views

maple, expansion of definite integral to series

i have trouble with this following integral due to the s upper limit. i have tried series and expand , but i understond the assigment is to use convert(series()).enter image description here int(sin(x*...
Divizia de Lemn's user avatar
0 votes
1 answer
75 views

Unexpected angle value

I have a vector A with coordinates (-51.85,-2.38,-0.93). The normal vector at point A(lets call it Na) is (0,0,1). I want to calculate the angle between the position vector A and the normal vector Na. ...
Tariq Islam's user avatar
0 votes
0 answers
45 views

How can I remove rows with N/A values after tabulating the database?

This is the code itself. The issue arises when I tabulate the information; the table contains 'Na' values for species that are not found in the sample area. Therefore, I need to find a way to ...
Darthgigas's user avatar
-3 votes
0 answers
38 views

What Advantages Does the Numpy Array Have over a Nested list? [duplicate]

here, i was confused to understand the nested list which appears complicated to me sometimes. please just explain it to me. it was my first time using numpy in python, so I really don't know what it ...
Varma Vegesna's user avatar
-2 votes
1 answer
46 views

"unsupported operand type(s) for +: 'int' and 'str'" [duplicate]

Ive been trying to find a solution to this problem for a while now but I did not find a single way to fix my problem, it would be great if somebody helped me out here. So basically I wanted to create ...
flörian's user avatar
0 votes
0 answers
20 views

Numerical Integration within lsqcurvefit function handle

Need to optimize C parameters in func handle using lsqcurvefit. func handle is also calling multiple handles one of them being L_(@Vf) which contains integral function. The problem is when I want to ...
Miro's user avatar
  • 3
-6 votes
0 answers
88 views

Write a function that accepts two floats x and y and returns the bottom-left coordinate of the parallelogram in which the point (x,y) falls [closed]

The following four coordinates define the vertices of a parallelogram: We can tile the entire plane with similar parallelograms: (the parallelogram highlighted in red is the same as the one in the ...
cosygod's user avatar
  • 31
0 votes
1 answer
31 views

Make the humanoid avatar always parallel to x-axis and facing -z direction in Unity

I am working with an external real-time motion capture system and stream the people real-time into Unity in the form of a skeleton avatar. So at any point, I have a tracked humanoid avatar in certain ...
holouser's user avatar
  • 172
2 votes
1 answer
100 views

How to start an interval from the second list in the first list?

wells = [ [ [0, 0.4, 'pop'], [0.4, 0.8, 'sup'], [0.8, 1.2, 'muka'], [1.2, 2, 'sand'], [2, 2.4, 'buz'] ], [ [0, 0.4, 'pop'], [0.4, 1....
Tommy Vercetti's user avatar
0 votes
0 answers
51 views

How does one edit indices of a list nested within several lists in Python?

Right now I'm trying to create a tree of nested lists for a math expression parsing function. Yes I know there are probably more efficient alternatives that already exist, but I'm dead set on writing ...
Mello Mantra's user avatar
0 votes
0 answers
50 views

What's the error in this solution to a problem asking minimum steps to reach 1 given a number?

I need to find the minimum required steps to reach 1 given a number, up to 9^309, and am using python 2.7 for this. I'm only allowed three kinds of operations: add 1, subtract 1, and divide by 2 if ...
Menelik Berhan's user avatar
0 votes
0 answers
39 views

What equation would express multiple values of x for only one value of n, within a threshold of requirements?

Simplified Problem My question is a bit complex to be explained within the title, though what I'm truely looking for is an equation that can, as the title mentions, "express multiple values of x ...
Justin Neugebauer's user avatar
-3 votes
0 answers
25 views

Need to draw the latex diagram [closed]

enter image description here Could you help to draw the latex diagram of this figure. It is important diagram in bilogical neural networks. Or you can draw any iother related single biological neurons ...
SUNNY SINGH's user avatar
0 votes
1 answer
59 views

Find subsystem in linear system [closed]

Given a linear system M x = 0 where M is an m, n matrix and x is a vector with n entries, there are multiple ways to find a non-trivial solution for x like singular value decomposition (SVD). In my ...
Citizen3011's user avatar
0 votes
0 answers
30 views

How to formulate multiple condition weighted average using sql in PostgreSQL?

I want to calculate weighted average for h based on this conditions: If my table has only one row for p.id then use that value If there are multiple rows from join with same table2_id then calculate ...
ambivalent's user avatar
-1 votes
0 answers
20 views

Reduce to row reduced echelon form [closed]

Determine whether the following system is consistent. If so, compute its general solution and identify the free and basic variables 𝑥1 − 𝑥2 − 3𝑥3 + 𝑥4 = −2 −2𝑥1 + 2𝑥2 + 6𝑥3 = −6 3𝑥1 − 2𝑥2 − 8�...
nbrlthf's user avatar
2 votes
4 answers
132 views

Give change using optimal denominations *considering that using descending units might not result in a correct result

I'm struggling to solve a problem regarding a programming challenge: Rules: The cash register only has $2, $5, and $10 bills. Your algorithm should determine the best way to give change for any ...
Jérôme Delodder's user avatar
-1 votes
0 answers
19 views

unable to open a file (Unix executable file) containing containing data saved from Scilab [closed]

I've couple of files saved from Scilab containing data and heavy calculation (done with a super calculator). Mac shows the file as Unix executable file. I used to use 'Load' on scilab to open the file ...
Dhamad's user avatar
  • 1
0 votes
0 answers
26 views

Discrete approximation of the Mandelbrot set

I have the following task: draw a discrete approximation of the Mandelbrot set for the quadratic family on the complex plane. I need to do this with a list-based implementation. I have already created ...
lizsav's user avatar
  • 75
0 votes
1 answer
87 views

Rounding errors when computing intersection between two lines in python

I'm attempting to create a Python script that identifies all the unique intersection points, eliminating duplicates, among all the lines passing through a subset of points of a regular grid in 2D or ...
Edoardo Serra's user avatar
1 vote
1 answer
59 views

Need a particular mathematical function to standardise animation duration

I am using framer-motion (React) to animate a slider containing 100 slides. The animation simply moves the slides to the left relative to the viewport so that the target slide is directly in the ...
hran944's user avatar
  • 15
1 vote
0 answers
43 views

Using distance from two points to a line, how to find line slope? [closed]

I have two point's coordinates and a distance to a line from each point (the distance is signed and measured on a normal perpendicular to the line). How can I find the line's slope?
Maz's user avatar
  • 81
0 votes
1 answer
26 views

Finding the correct intersection point for a right-hand bend

I am trying to calculate curves (their coordinates), for this I have the start point and the end point. I need the center so that I can draw the curve in the right direction. Now the question is, how ...
Powershooter83's user avatar
0 votes
1 answer
50 views

Simplifying an arithmetic expression in Python

I'm trying to write a python code on simplifying a given expression (in order to solve a non-homogeneous linear diophantine equation.) For example, given the input: 7x+13y = 1 the code will return 1=...
MaximeJaccon's user avatar
-5 votes
0 answers
63 views

JavaScript Calculator issues: If 2 or more operators are entered consecutively

I am building a JavaScript calculator as a project. I can not figure out a situation with the "-" (negative/subtract). If 2 or more operators are entered consecutively, the operation ...
Eric Purtlebaugh's user avatar
0 votes
2 answers
46 views

Vectorizing this operation with numpy

To introduce this problem, let's say that I have a 2D array (Nx3) storing N points. On the other hand, I have a 1D array (M, 3) containing the coordinates of a single 3D reference point therefore M=1 ...
Manu's user avatar
  • 60
0 votes
0 answers
55 views

How to connect intervals from two lists to each other?

data = [ [ [0, 4, 'soil'], [4, 8, 'clay'], [8, 12, 'silty_clay'], [12, 20, 'sandy_gravel'], [20, 24, 'basalt'] ], [ [0, 4, 'soil'], [...
Tommy Vercetti's user avatar
-4 votes
0 answers
33 views

How do i make a math solver that looks for a place to input the correct number on a website? [closed]

I would like to make an instant math solver that automaticaly inputs the correct number, how do I do that? (either in python or html) So I am using my only resort an i'm now asking you guys because i ...
LAVA20's user avatar
  • 1
-1 votes
0 answers
37 views

Python code for print a Matrix and Transpose of matrix [closed]

How to input elements of matrix and how we can can use list comprehension and how to make transpose of it, and what are the the problem we should faced while writing the coding and how we should ...
Arjun's user avatar
  • 1
0 votes
0 answers
52 views

Link custom math library in C

I'm trying to run a C program (main.c) with an external math library libmcs (https://essr.esa.int/project/libmcs-mathematical-library-for-critical-systems), which has been compiled using MinGW ...
Giovanni Bay's user avatar
2 votes
1 answer
58 views

Optimization trading items - min cost max flow

There is n items, . I have n items, but some duplicates and some are missing, I need to have exactly one of each item. There is given a trade-table that tells which items can be traded for others. For ...
popcorn's user avatar
  • 69
-4 votes
0 answers
73 views

How do i solve this complex non-linear method with js?

Net = ( basic + housing + transport ) - (PAYE + INSS ) Tables(Gross) basic : x housing : 30 % of basic Transport Allowance: Net Salary Range Transport Allowance 0 to 500 50 501 to 750 ...
Shaun K's user avatar

1
2 3 4 5
879