Questions tagged [square-root]

A square root of a number A is a number y such that y^2 = A, or, in other words, a number y whose square (the result of multiplying the number by itself, or y × y) is A.

A square root of a number A is a number y such that y2 = a, or, in other words, a number y whose square (the result of multiplying the number by itself, or y × y) is A.

398 questions
4
votes
2 answers

Clojure: Complex Iteration Across a List?

I'd like to take a number, 20, and a list. '(1 2 3 4 5 6 7 8 9 10), and return a collection containing two values for each value in the original list: the original value paired with the remainder when diving 20 by that value. It would be nice if the…
dmbennett
  • 109
  • 1
  • 8
4
votes
4 answers

Getting an infinite loop in Babylonian Algorithm for square roots in C++

I have thoroughly searched for this topic all over the internet, and the threads are either dead, or use a different method than what is described in my book. For example, http://www.geeksforgeeks.org/square-root-of-a-perfect-square/ . This doesn't…
4
votes
2 answers

OverflowError: long int too large to convert to float

I am trying to get the square root of a really large number yet I get the error: deltaSqrt = pow(delta,0.5) OverflowError: long int too large to convert to float In my case delta is equal…
Teodora
  • 687
  • 2
  • 11
  • 21
4
votes
1 answer

Running time of a loop up to i*i <= n

Here is the code: int foo(int n) { if(n == 1) return 1; int f = 0; int i; for(i=1; i*i<=n; i++) if(n%i == 0) f+=2; i--; if(i*i == n) f--; return f; } My problem is that I cannot…
4
votes
3 answers

Logical thinking for a Calculation of Square root

I've been trying to decipher this problem for the last hour right now and having some trouble here. This is the problem This method for calculating the square root of a number n starts by making a (non zero) guess at the square root. It then uses…
Suliman Sharif
  • 607
  • 1
  • 9
  • 26
4
votes
4 answers

More Digits in Irrational Numbers

>>> str(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702) '1.41421356237' Is there a way I can make str() record more digits of the number into the string? I don't understand…
Sylvester V Lowell
  • 1,243
  • 1
  • 12
  • 13
4
votes
3 answers

Square root of a 100 digit number in C++

'unsigned long long' can solve upto 15 digits. Is there a way to find square-root of a 100 digit number?
user2278992
  • 93
  • 1
  • 2
4
votes
4 answers

Square root function in Python - what's wrong with it?

I literally just started learning Python this week. (I will be a computer science fresher in a month!) Here's a function I wrote to compute the square root of x. #square root function def sqrt(x): """Returns the square root of x if x is a…
user1639304
  • 41
  • 1
  • 4
3
votes
1 answer

Square root of a u128

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
  • 61,411
  • 155
  • 482
  • 830
3
votes
3 answers

How to change √243 to 9√3 in python? And how to change squared root generally?

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? Code: import math dl=int(input("Podaj długość:…
3
votes
3 answers

square root character/symbol

I was wondering what the character code of the square root symbol is in java? That is, I want to be able to print a square root sign on screen inside a string of other characters, or as the label on a button.
scaevity
  • 3,991
  • 13
  • 39
  • 54
3
votes
2 answers

How to get an arbitrary root in C?

C has sqrt() and cbrt(), but those are only the second and third roots. What if the root is an arbitrary number? What if I need the 57nth root?
user15185126
3
votes
1 answer

How to make a square root fit to data in Julia 1.0

I have a very simple question. How would one fit a square root model to a dataset in Julia. I'm currently using the GLM package, which works very well with linear data. I need to plot a phase velocity as a function of string tension, and it seems…
sesodesa
  • 1,473
  • 2
  • 15
  • 24
3
votes
2 answers

Calculate Square root to decimal places in bash

I am writing a simple bash script to calculate a square root to 3 decimal places by default but the user can set the number of places... Nothing complex, I just iterate from 1 to the lowest square root. Since my bash is still basic this is what I…
Aderemi Dayo
  • 705
  • 1
  • 11
  • 25
3
votes
1 answer

Fast inverse arbitrary power root algorithm implementation

Many sources indicate that well-known fast inverse square root algorithm can be generalized to calculation arbitrary power inverse root. Unfortunately I have not found such C++ implementation and I'm not so good at math to generalize this method by…