Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8865617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:33:29+00:00 2026-06-14T16:33:29+00:00

By primitive expressions, I mean + – * / sqrt , unless there are

  • 0

By primitive expressions, I mean + - * / sqrt, unless there are others that I am missing. I’m wondering how to write a Scheme expression that finds the 6th root using only these functions.

I know that I can find the cube root of the square root, but cube root doesn’t appear to be a primitive expression.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:33:30+00:00Added an answer on June 14, 2026 at 4:33 pm

    Consider expt, passing in a fractional power as its second argument.

    But let’s say we didn’t know about expt. Could we still compute it?

    One way to do it is by applying something like Newton’s method. For example, let’s say we wanted to compute n^(1/4). Of course, we already know we can just take the sqrt twice to do this, but let’s see how Newton’s method may apply to this problem.

    Given n, we’d like to discover roots x of the function:

    f(x) = x^4 - n
    

    Concretely, if we wanted to look for 16^(1/4), then we’d look for a root for the function:

    f(x) = x^4 - 16
    

    We already know if we plug in x=2 in there, we’ll discover that 2 is a root of this function. But say that we didn’t know that. How would we discover the x values that make this function zero?

    Newton’s method says that if we have a guess at x, call it x_0, we can improve that guess by doing the following process:

    x_1 = x_0 - f(x_0) / f'(x_0)
    

    where f'(x) is notation for the derivative of f(x). For the case above, the derivative of f(x) is 4x^3.

    And we can get better guesses x_2, x_3, … by repeating the computation:

    x_2 = x_1 - f(x_1) / f'(x_1)
    x_3 = x_2 - f(x_2) / f'(x_2)
    ...
    

    until we get tired.

    Let’s write this all in code now:

    (define (f x)
      (- (* x x x x) 16))
    
    (define (f-prime x)
      (* 4 x x x))
    
    (define (improve guess)
      (- guess (/ (f guess)
                  (f-prime guess))))
    
    (define approx-quad-root-of-16
      (improve (improve (improve (improve (improve 1.0))))))
    

    The code above just expresses f(x), f'(x), and the idea of improving an initial guess five times. Let’s see what the value of approx-quad-root-of-16 is:

    > approx-quad-root-of-16
    2.0457437305170534
    

    Hey, cool. It’s actually doing something, and it’s close to 2. Not bad for starting with such a bad first guess of 1.0.

    Of course, it’s a little silly to hardcode 16 in there. Let’s generalize, and turn it into a function that takes an arbitrary n instead, so we can compute the quad root of anything:

    (define (approx-quad-root-of-n n)
      (define (f x)
        (- (* x x x x) n))
    
      (define (f-prime x)
        (* 4 x x x))
    
      (define (improve guess)
        (- guess (/ (f guess)
                    (f-prime guess))))
    
      (improve (improve (improve (improve (improve 1.0))))))
    

    Does this do something effective? Let’s see:

    > (approx-quad-root-of-n 10)
    1.7800226459895
    > (expt (approx-quad-root-of-n 10) 4)
    10.039269440807693
    

    Cool: it is doing something useful. But note that it’s not that precise yet. To get better precision, we should keep calling improve, and not just four or five times. Think loops or recursion: repeat the improvement till the solution is “close enough”.

    This is a sketch of how to solve these kinds of problems. For a little more detail, look at the section on computing square roots in Structure and Interpretation of Computer Programs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any primitive data type that it's safe to not initialize? How about
According to JLS( 15.28 Constant Expressions) an expression containing only: i) Literals of primitive
The Java Virtual Machine Specification says that there is limited support for boolean primitive
I have java primitive int and its wrapper Integer ,do it mean that the
The code below works fine for primitive expressions (no surprise there) public class SiteContextExpressionBuilder
How can we new primitive types in JNI. I have a function that returns
Are java primitive integers (int) atomic at all, for that matter? Some experimentation with
Sometimes I met such expressions as aClass$field instead of aClass.field. What does it mean
Is there a typeof like function in Java that returns the type of a
Why there is primitive type for integer(int) even though we have an object for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.