Scripts
global
prime
power
newtonraphson
fibonacci
file
multithread
digitcubes
perfectseries
perfecttest
kapreckerNumber
kapreckerConstant
hawkresponse
entityTemplate
array
multipleAssignment
global
prime
power
newtonraphson
fibonacci
file
multithread
digitcubes
perfectseries
perfecttest
kapreckerNumber
kapreckerConstant
hawkresponse
entityTemplate
array
multipleAssignment
alias mm = MathModule
function main()
{
var N = 512
echo " cuberoot of {" + N + "} is {" + `exec mm->scale(`exec newtonraphson(N/3, N)`,2,"halfup")` + " }"
}
function newtonraphson(var x , var N)
{
var y = 2*x/3 +N/(3* `exec pow(x, 2)`)
var tmp = `exec pow(y, 3)` - N
if(tmp < 0.01)
{
return y
}
return `exec newtonraphson(y,N)`
}
function main()
{
var N = 512
echo " cuberoot of {" + N + "} is {" + `exec mm->scale(`exec newtonraphson(N/3, N)`,2,"halfup")` + " }"
}
function newtonraphson(var x , var N)
{
var y = 2*x/3 +N/(3* `exec pow(x, 2)`)
var tmp = `exec pow(y, 3)` - N
if(tmp < 0.01)
{
return y
}
return `exec newtonraphson(y,N)`
}
cuberoot of {512} is {8}