ScratchData LogoScratchData
Back to grandpasp's profile

nth Root of X

GRgrandpasp•Created February 7, 2024
nth Root of X
0
1
24 views
View on Scratch

Instructions

This project calculates the nth root of a number. When prompted, enter a value for X (positive or negative, integer or float) then enter a value for n (an integer and must be an odd number if X is negative).

Description

The algorithm is a trial and error method using a "binary" search (cutting the search range in half each time). Crude but simple! I narrow down the search range each pass (in the direction indicated by whether the result is high or low) until the error is less than 0.00001, then quit.

Project Details

Project ID962988137
CreatedFebruary 7, 2024
Last ModifiedFebruary 10, 2024
SharedFebruary 8, 2024
Visibilityvisible
CommentsAllowed