It's UWAweek 47

help3001

This forum is provided to promote discussion amongst students enrolled in CITS3001 Advanced Algorithms.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 2 articles in this topic
Showing 2 of 202 articles.
Currently 27 other people reading this forum.


 UWA week 33 (2nd semester, week 4) ↓
SVG not supported

Login to reply

👍?
helpful
8:23pm Fri 16th Aug, ANONYMOUS

Hi. I have a problem on calculating cube root and sqcube for large number. For example cube root of 1000 is 10 but when i calculate it using python (1000 ** (1/3)) my output always 9.99999999 leading to output alway being 1 unit wrong from the result. i have tried abs, round non of them work. How can i fix this problem


 UWA week 34 (2nd semester, week 5) ↓
SVG not supported

Login to reply

👍?
helpful
11:02am Mon 19th Aug, Andrew G.

ANONYMOUS wrote:

Hi. I have a problem on calculating cube root and sqcube for large number. For example cube root of 1000 is 10 but when i calculate it using python (1000 ** (1/3)) my output always 9.99999999 leading to output alway being 1 unit wrong from the result. i have tried abs, round non of them work. How can i fix this problem

This is because by doing ** (1/3) in Python you have turned this int a floating point calculation. There are ways to make this work, but you do not need to.

Remember that we encourage you to speak to lab facilitators to help you work through the process of solving the problem, and there are hints on the lab sheet for if you get stuck.

I will point out that squares and cubes are defined as being the square or cube of some integer. You appear to be focusing on trying to test a given number to determine if it is a square or a cube. Is there some other way you could determine what numbers in a range are squares and what are cubes without testing them all individually?

Cheers, Gozz

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy