473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Cubic root

I'm trying to calculate the cubic root of a fonction, what syntax should I
use?

Thanx
PHIL
Jul 20 '05 #1
2 3504
"Philip KOCH" <ph**********@hotmail.com> writes:
I'm trying to calculate the cubic root of a fonction, what syntax should I
use?


A cubic root would be the same as raising to the 1/3rd power. You can make
your own cubicRoot function:

function cubicRoot(n) {
return Math.pow(n,1/3);
}

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
JRS: In article <3f**********************@reader3.news.skynet.be >, seen
in news:comp.lang.javascript, Philip KOCH <ph**********@hotmail.com>
posted at Tue, 11 Nov 2003 01:57:24 :-
I'm trying to calculate the cubic root of a fonction, what syntax should I
use?


One that allows the argument to be negative.

function cubeRoot(X) {
return (X<0 ? -1 : +1) * Math.pow(Math.abs(X), 1/3) }

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lawrence | last post by:
My company is leasing a server from Interland, which is a very large web hosting company. I assume Interland knows how to set up a BSD server with the usual add-ons, including PHP. But when I run...
8
by: JKop | last post by:
Could someone please point me to somewhere where I can get a full complete reference of the C++ Standard Libaries, how to use all their functions and global varibles. Is there any function in...
15
by: Stig Brautaset | last post by:
Hi group, I'm playing with a little generic linked list/stack library, and have a little problem with the interface of the pop() function. If I used a struct like this it would be simple: ...
13
by: Kishor | last post by:
Hi Friends Please help me to write a C program to find the 5th (fifth) root of a given number. Ex:(1) Input : 32 Output : 5th root of 32 is 2 Ex:(1) Input : 243 Output : 5th root of 243 is...
3
by: Nalaka | last post by:
Hi, I have an asp.net web application (www.myWebSite), and a subweb application (www.myWebSite/subSite). How do I set it so that, subweb application (www.myWebSite/subSite) be the root...
2
by: shiva359 | last post by:
Hi , could someone throw some light on why do default software when installed ( as root for creating an instance leaves us with some world accessable directories & some ...
4
by: Peng Yu | last post by:
Hi, I'm wondering how to get the cubic root for a complex number? It seems that cbrt does not work complex numbers. Thanks, Peng #include <complex> #include <iostream>
2
by: Peng Yu | last post by:
Hi, I have the following program which computes roots of a cubic function. The solution is sensitive to the type, which is due to the truncation error. 'long double T' gives three solutions, and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.