sqrt

    2熱度

    1回答

    我需要一些幫助。它應該包含一個整數列表的所有元素,並返回一個Float列表,其中包括3個變體:1)遞歸,2)列表推導,3)更高階的函數。我已經寫了第一個,它工作得很好: -- recursive: sqrtL1 :: [Integer] -> [Float] sqrtL1 [] = [] sqrtL1 (n:ns) = (sqrt x) : sqrtL1(ns) where x

    1熱度

    1回答

    我使用的是STM32F4芯片(皮質-M4)與FPU和 的sqrt(9.7 * 9.7)返回94.17 .. 我使用arm-none-eabi-gcc編譯器,並且在編譯時不會出現任何錯誤。 我的makefile真的很長,因爲stm32f4和sam4芯片使用了相同的文件。我甚至不知道要發佈的相關部分。任何幫助表示讚賞。 編輯: float x, y, z, mag; x = ((float) (((

    -5熱度

    2回答

    編寫一個函數printsquares(numin),即參數numin。所述numin成爲一個for循環的上端與一系列因此: for i in range(numin) 並作爲用於循環執行它的範圍內打印的每個i的平方。這裏是運行: >>> printsquares(6) 0 1 4 9 16 25 >>> 這是我應該爲我的問題做我剛纔似乎無法得到平方根打印像例子。 這裏是我的代

    0熱度

    1回答

    #include <iostream> #include <cmath> using namespace std; bool prime(int n); int main() { double i; while (true) { cout << "Enter a number that isn't 0: "; cin >> i;

    1熱度

    1回答

    我有一個稀疏矩陣: from scipy import sparse a = sparse.diags([1,4,9],[-1,0,1],shape =(10,10),format ="csr") 我想借此每個稀疏矩陣 我期待在互聯網上元素的平方根,它說我可以使用numpy.sqrt()來實現這一點。 但發生錯誤: b = numpy.sqrt(a) AttributeError:

    1熱度

    3回答

    我在Objective-C的這些功能: -(void)emptyFunction { NSTimeInterval startTime = [[NSDate date] timeIntervalSinceReferenceDate]; float b; for (int i=0; i<1000000; i++) { b = [self returnNr

    6熱度

    1回答

    的總和我有MinGW的GCC 4.8.1和下面的代碼: #include <iostream> #include <cmath> double eval(int a, int b){ return std::sqrt(a) + std::sqrt(b); } int main(){ double first = eval(545, 331); double

    -9熱度

    1回答

    我需要編寫自己的sqrt函數:double my_sqrt_1(double n) 我該如何去做這件事?起初,我試圖把 「)INT主(」 本外: double my_sqrt_1(double n) { int x = 1; x = (x + n/x)/2; } 然後我把這個: int main() { cout << "Please enter a val

    2熱度

    3回答

    我知道Python有cmath模塊來查找負數的平方根。 我想知道的是,如何爲100個負數的數組做同樣的事情?

    0熱度

    2回答

    我在寫一段代碼來幫助我解決Python中的勾股定理。問題是,我不斷收到這樣的出錯時,我的代碼試圖求解B. 這是一個總是給我的問題位: bsqr = (int(c) ** 2) - (int(a) ** 2) b = int(bsqr)/sqrt(bsqr) 我得到這個錯誤: Traceback (most recent call last): File "<pyshell#24>", li