Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
153 views

I'm currently trying to implement Karatsuba Sqrt for my BigInteger module in luau, though I'm having trouble with its accuracy and I don't know what I'm doing wrong. Karatsuba function: local function ...
fosterchild's user avatar
4 votes
3 answers
311 views

In an algorithm I am using, most of the time is spent in the evaluation of square roots using the sqrt function in cmath. In my application I only need the integer part of the square root of integers, ...
doetoe's user avatar
  • 831
-1 votes
3 answers
85 views

I feel like I have everything right I just can't seem to get the square root right. Every time I run it the answer is off. For example, when I plug in 100 it spits out 26 as the square root, which isn'...
Qui333's user avatar
  • 7
-5 votes
1 answer
169 views

How can I use Haskell to find the square root of a negative integer?
bhadra's user avatar
  • 13k
0 votes
1 answer
142 views

My code for large integer sqrt <?php $y2 = gmp_init('28626386478758000000000000909090904'); // Example GMP number $sqrt = gmp_sqrt($y2); echo "Square root is: " . gmp_strval($sqrt) . &...
Asif Iqbal's user avatar
  • 1,238
-1 votes
1 answer
109 views

I have to do a maths exercise that requires me to frame √3 with an amplitude of 10^-5. Using the sweep method and Python. I'm French so I don't know if "sweep" is the right word. Earlier in ...
Jean-François Vivicorsi's user avatar
1 vote
3 answers
300 views

I am trying to solve a system of non-linear equations using Python (under-expanded jet with losses - Molkov): I am trying to use the library Scipy and the module fsolve: def equations10(p): u3, ...
Guillaume THIRIET's user avatar
0 votes
1 answer
50 views

I want to optimize a problem in which the objective contains the square root and inverse of a variable. I tried writing like this: using CP; dvar int+ y; dvar int+ z; minimize z; subject to{ z==4/...
SUBHADARSHINI PANDA's user avatar
1 vote
1 answer
65 views

I was attempting the #69 problem of leetcode, which involves finding square root of given number. I proceeded via a binary search approach. int mySqrt(int x) { if (x==0 || x==1){ return x; ...
Yogesh Yadav's user avatar
7 votes
2 answers
969 views

I am trying to analyze the time complexity of the default integer square root function in Python 3.8+ versions, math.isqrt() I have tried to peruse the time complexity of this function as a function ...
qxzsilver's user avatar
  • 663
1 vote
0 answers
71 views

On uops.info VRSQRTPS is listed as having a lower latency than VSQRTPS across all the architectures I've checked. It also has a lower throughput but perhaps there are less units that can do it on most ...
Sea Erchin's user avatar
0 votes
1 answer
84 views

I am very new to this and I am trying to write a program that determines whether an integer has an integer root (or not). I have combined many different ways to narrow down the search range to find ...
Timothy Chang's user avatar
0 votes
2 answers
52 views

I am attempting to create a function in Python 3.11.4 to simplify radical expressions; the first step is to find the closest perfect square below the number. To do this, I tried making a function that ...
vondeehair's user avatar
3 votes
1 answer
280 views

In the documentation for the ARM instruction frsqrts, it says: This instruction multiplies corresponding floating-point values in the vectors of the two source SIMD and FP registers, subtracts each ...
user14717's user avatar
  • 5,351
0 votes
0 answers
193 views

#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { double a, b, c; for (a = 1; a < 333; a++) { for (c = 335; c < 998; c++) { ...
idk.mp3's user avatar
  • 43
0 votes
1 answer
645 views

I am trying to calculate the square root, and keep the part which could not change into integer in C++, and I found This post on Stack Overflow, but it will still have decimal. For example, if I want ...
Han Han's user avatar
  • 482
-1 votes
1 answer
486 views

while finding a square-root, we perform number**0.5, but what is the meaning of - sign before 0.5. I was looking at a code (I was specificially looking at ViT Code, and here for scaling, they have ...
Yogendra Yatnalkar's user avatar
0 votes
1 answer
226 views

For example, I have data like below. genotype=rep(c("A","B","C","D","E"), each=5) env=rep(c(10,20,30,40,50), time=5) outcome=c(10,15,17,19,22,12,13,15,...
J.K Kim's user avatar
  • 974
0 votes
1 answer
397 views

When I plot the graph of math.sqrt(1-x**2), the graph has unnatural bumps in it. How do I fix this? I'm very new to Manim. Here's my code: from manim import * import math class Myscene(Scene): def ...
HelloMoto's user avatar
0 votes
0 answers
51 views

Tried to code bisection method to compute square root of 2, till the difference between two consecutive steps is less than some specific value, say 10^{-11}, where tolerance variable is specified as ...
jitender's user avatar
  • 109
1 vote
1 answer
83 views

I made a program using difference equation initial conditions for each number, but as you can see the code didn't give me satisfying results, plus it took more loops than it's supposed to, it should ...
Lily's user avatar
  • 13
0 votes
2 answers
173 views

Question: Write a program that implements Newton’s method to compute and display the square root of a number entered by the user. The algorithm for Newton’s method follows: Read x from the user ...
Sameen's user avatar
  • 1
0 votes
1 answer
320 views

I have implemented docplex model with python, everything goes well: problem formulation, variables, constraints and objective function. The problem raised when I tried to compute Euclidian distance ...
Rashad Moqa's user avatar
0 votes
1 answer
692 views

I am trying to write code that can print a square root to the console. Here is an example of some code from math import sqrt print("ax\N{SUPERSCRIPT TWO} + bx + c") a = int(input("...
NerdKnight66's user avatar
-3 votes
1 answer
481 views

Just an exercise: func mySqrt(_ x: Int) -> Int { if x<2 { return x } var y = x var z = (y + (x/y)) / 2 while Double(abs(y - z)) >= 0.00001 { y = z z = (y + (...
Renuka Pandey's user avatar
1 vote
0 answers
141 views

I am tasked with creating a program in java which calculates the square root of a double and goes through each step of calculating it manually. The requirements are: split the number into number ...
PizzaPossum's user avatar
0 votes
2 answers
204 views

In some specific numbers my algorithm gets stuck. It never reaches the minimum approximation so we never get out of the while. I think I can either low my approximation requisites or use double for my ...
Gustavo's user avatar
0 votes
1 answer
218 views

I want to test the following property in Dafny: a^2<=b^2*c^2 implies a<=b*c. It automatically checks this for (positive) integer numbers: lemma powersVSsquares_integers(a:int, b:int, c:int) ...
Theo Deep's user avatar
  • 786
-2 votes
1 answer
497 views

I am to find the standard deviation. When calculating the standard deviation, my outputs are way higher than the given sample. How do I go calculating the standard deviation of each column? Here is my ...
user avatar
1 vote
2 answers
484 views

I'm trying to build a program that let's you multiply two square roots and display the answer in surd form if the answer isn't an integer. I've seen answers here and here, although I don't understand ...
Praseodymium-141's user avatar
-1 votes
1 answer
986 views

I am trying to compute the square root of 2 (up to nearly 10 million digits) with the following code import os os.chdir('/home/username/Desktop') def sqroot(a, digits): a = a * (10**(2*digits)) ...
RandomCoder's user avatar
-4 votes
1 answer
191 views

I am in codewars and the challenge I have has one part I can't get my head around this is what I am speaking of You are given a number "n" (n >= 0) and a digit "d" (0 <= d &...
Logono's user avatar
  • 5
-2 votes
2 answers
225 views

So say you are given the numbers 27 and 81. How would a program that tells you that the 4th root of 81 is 3 and the cubic root of 27 is three. (Both have the root of 3). x = 16; y = 4; foo = ...
Samir Warner's user avatar
0 votes
1 answer
1k views

I had some data that was negatively skewed in r. The transformation I used was: sqrt(max(x+1)-x) from this website: https://www.datanovia.com/en/lessons/transform-data-to-normal-distribution-in-r/. ...
OliverAshton1's user avatar
5 votes
0 answers
1k views

I am performing a ton of distance calculations in my code, to the point where Math.sqrt(a*a + b*b) is run hundreds of thousands of times. I then recalled how there is a Math.hypot function that does ...
Ryan Peschel's user avatar
  • 12.1k
0 votes
2 answers
579 views

simple question is there an operator for the root as for the power there's the "* *". I tried to search but I couldn't find it, so I don't think there is, but if for any reason I didn't saw ...
Filippo Canino's user avatar
-2 votes
1 answer
3k views

Taking the square root of each number in a list. For this problem in the sqrt_list function: Take the square root of each item in the list, Store each squared item in another list, and Return this ...
guest7238's user avatar
0 votes
1 answer
479 views

I'm trying to compute the simplest form of the square root of an integer. My Java knowledge is rather limited, but I know many of the basics and such. I can't figure out how to find a simplest form ...
Connor Eddy's user avatar
3 votes
1 answer
2k views

It's not that I don't understand how to find the integer square root of a number. I know several ways of finding them using Python and C++. It's just that this algorithm is really messing with my ...
Artique's user avatar
  • 39
0 votes
1 answer
213 views

library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity RaccinCarreSequentielle is generic( N: natural:= 16 ); port( X: unsigned(2*N-1 downto 0); reset : in ...
Duy-Manh NGUYEN's user avatar
3 votes
1 answer
2k views

How can the square root of a u128 be calculated? The resulting number can be a u128 after some rounding. f64 has a f64::sqrt function, but I dont think we should be converting u128 to f64.
Nyxynyx's user avatar
  • 64.2k
0 votes
1 answer
482 views

Below I have adapted code from William Kahan and K.C. Ng (look at the comment block on the bottom) written in 1986 to produce an approximation of 1 / sqrt(x) where x is an IEEE-754 double precision ...
Adam Hyland's user avatar
  • 1,085
0 votes
1 answer
161 views

I am trying to propagate uncertainty in Python by adding two columns together of a Pandas data frame and then taking the square root. However, when I try to use Python's math.sqrt function, I receive ...
325's user avatar
  • 616
2 votes
2 answers
114 views

I made a python script to find the square root of a number and prints out the result so far, but it uses an infinite loop and I cannot stop it. Does anybody know how to stop it when it has printed out ...
Concode's user avatar
  • 23
-1 votes
1 answer
1k views

Playing around with formulas in C, I realized that I found a formula for calculating the square root of a number. I would like to know if such an algorithm already exists, or if it is widely known to ...
user avatar
0 votes
4 answers
9k views

I transformed the coordinates of two atoms into an array: coord And I must calculate the root mean squared deviation (RMSD) between the two sets of these coordinates. For this I have: def ...
Angellys Correa's user avatar
3 votes
3 answers
291 views

I have a math/python question, how to change big number in squared root, to small number (but still keeping the value), for example √243 to 9√3? And I have another question, how to use it in my code? ...
DrEsperanto's user avatar
1 vote
1 answer
92 views

For a given string of distinct letters map each letter to a digit such that number formed is largest square possible having distinct digits. eg: c – 9, a – 8, r – 0, e – 1: 9801 h – 9, a – 6, b – 7, ...
Vidhi Shah's user avatar
0 votes
1 answer
555 views

I have written a simple calculator program in C# which can also calculate the square root of any number. So, I was just wondering if you could display said number in a label. Or rather display it like ...
DieserTBZ's user avatar
0 votes
0 answers
69 views

I have a task to calculate a square root using the Newton method using a function within a function. The user enters a number that he wants to know his root and another number that is his guess to the ...
Michael ilkanayev's user avatar

1
2 3 4 5
9