posted 5 years ago

I want to calculate 9th root of a number without using any build in functions.

it can be in c,c++, or java.

so kindly suggest me

Logarithm is a good option, but how to calculate Anti log

it can be in c,c++, or java.

so kindly suggest me

Logarithm is a good option, but how to calculate Anti log

Campbell Ritchie

Marshal

Posts: 56529

172

posted 5 years ago

You need to look up some algorithms. I think their expansions are called Taylor series. There are examples for sin, cos, log and exponentials, etc. I had to know them at school when I did maths. Once you know the algorithm, you can easily implement ln(

*x*) and exp(*x*) as`double`s. It’s quite easy.
Matthew Brown

Bartender

Posts: 4568

9

Mike Simmons

Ranch Hand

Posts: 3090

14

posted 5 years ago

Do you mean, other than +, - *, /? It's going to be hard (impossible) to do this without

And like Matthew, I'd look into using Newton's method. Have you had calculus? Do you understand how derivatives work, and what they mean?

*some*built-in math functions. Let's be specific about exactly what you're allowed to use.And like Matthew, I'd look into using Newton's method. Have you had calculus? Do you understand how derivatives work, and what they mean?

Campbell Ritchie

Marshal

Posts: 56529

172

posted 5 years ago

I know what you meant...sort of.

Here's the real point I'm trying to convey...In ALL software design, your specs are important. You need to think about every aspect of what you want to do, what you NEED to do, and what information you are conveying to others. Start learning that now. If you mean X, don't say Y. If you mean "without using the built-in Math class methods", then that is what you should say. because "math functions" (with a lower case 'm') means all the functions of mathematics, as Mike implies.

Gursewak Singh wrote:Fred mean to say, i don't want to use math functions for that

I know what you meant...sort of.

Here's the real point I'm trying to convey...In ALL software design, your specs are important. You need to think about every aspect of what you want to do, what you NEED to do, and what information you are conveying to others. Start learning that now. If you mean X, don't say Y. If you mean "without using the built-in Math class methods", then that is what you should say. because "math functions" (with a lower case 'm') means all the functions of mathematics, as Mike implies.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

posted 5 years ago

Exactly.Clear and precise communication is at the heart of all aspects of all successful software development endeavors. The syntax of the language is of vanishingly small importance when compared to making sure that all involved understand the requirements, constraints, options, and tradeoffs involved. Even poor design decisions, such as using bubblesort instead of mergesort, are often more easily fixed than a simple misunderstanding about how feature X is supposed to behave.

Of course, clearly and precisely communicating with the computer is also important. The compiler is, fortunately, a reliable and unforgiving master for the syntactical aspect of that, but we still have to be able to clearly and precisely express our logic if the code is to do what we want it to.

</soapbox>

fred rosenberger wrote:

Here's the real point I'm trying to convey...In ALL software design, your specs are important. You need to think about every aspect of what you want to do, what you NEED to do, and what information you are conveying to others. Start learning that now. If you mean X, don't say Y. If you mean "without using the built-in Math class methods", then that is what you should say. because "math functions" (with a lower case 'm') means all the functions of mathematics, as Mike implies.

Exactly.Clear and precise communication is at the heart of all aspects of all successful software development endeavors. The syntax of the language is of vanishingly small importance when compared to making sure that all involved understand the requirements, constraints, options, and tradeoffs involved. Even poor design decisions, such as using bubblesort instead of mergesort, are often more easily fixed than a simple misunderstanding about how feature X is supposed to behave.

Of course, clearly and precisely communicating with the computer is also important. The compiler is, fortunately, a reliable and unforgiving master for the syntactical aspect of that, but we still have to be able to clearly and precisely express our logic if the code is to do what we want it to.

</soapbox>

posted 5 years ago

FOUL!!!

Best case for bubble sort is O(N). Best case for MergeSort is O(n log n).

So, if you do proper data analysis, there are cases where choosing bubble sort could be a good decision.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Jeff Verdegan wrote:Even poor design decisions, such as using bubblesort instead of mergesort

FOUL!!!

Best case for bubble sort is O(N). Best case for MergeSort is O(n log n).

So, if you do proper data analysis, there are cases where choosing bubble sort could be a good decision.

posted 5 years ago

sorry friend if you got confused by me

Problem is solved now

Actually i was going to code a program with did not use any maths build in function like sqrt,pow etc in c/c++.

so i use Newton equation as suggested by you

but for this i design my own code to calculate power etc.

Thanks a lot for discussion.

Problem is solved now

Actually i was going to code a program with did not use any maths build in function like sqrt,pow etc in c/c++.

so i use Newton equation as suggested by you

but for this i design my own code to calculate power etc.

Thanks a lot for discussion.