Click to See Complete Forum and Search --> : mathematical operators?


geuis
04-07-2003, 04:42 PM
I know a few of the mathematical operators in JS, but I am wondering if anyone has a complete list of all of them. By operators, I mean +, -, less than, greater than, not equal, AND, OR, NOT, etc.
Thanks!

Geuis

viravan
04-07-2003, 04:53 PM
Check out the link shown below:

http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/expr.html#1008323


:)

V.V.

apezVal
04-07-2003, 06:12 PM
JavaScript supports the basic mathematical operators (exponentiation is available via the math method Math.exp()). The addition operator + is the only operator in the following table that also applies to strings -- where it refers to string concatenation.

+ addition
- subtraction
* multiplication
/ division
% modulo x % y; (remainder of x divided by y)
++ post/pre -increment x = var++;
assign var to x, then increment var (var+=1)
x = ++var; increment var < (var+=1), then assign var to x
-- post/pre decrement x = var--; assign var to x,
then decrement var (var-=1)
x = --var; decrement var < (var-=1),then assign var to x
---------
If anyone knows of other actual operators or ways to define these w js, please reply.

viravan
04-07-2003, 08:00 PM
exponentiation is available via the math method Math.exp()


You mean Math.pow()?

:)

V.V.

apezVal
04-07-2003, 08:22 PM
>exponentiation is available via the math method Math.exp()

I know that the anti-function of exponentiation can be defined as 'taking the logarithm." And i have info about the javascript for the "Math.log" method which is to base e=Napierian=natural logarithm,... but is there a definition for a general log to any base (e, 10 or n=var any number of as symbol?). And is there a method to define a Boolean set = f(0,1) ={ log(base-n), log(base-m)} where m and n can be 1(any integer) and 2(any rational number)?

__ Jim

apezVal
04-07-2003, 08:42 PM
Hi viravan ...who wrote:

>You mean Math.pow()?

Sorry, i got ahead of myself with my own questions here in this math js thread.

Apparently "Math.pow()" is the general method for the numeric dyad: (n,n') where the return is a new number that is identically "n to the n' power" ...we usually write this with the keyboard as n^n' so for n= 5 and n' = 2 , the new number or the returned value would be 25. The idea... (The JavaScript Functionality Hypothesis ???),... I would venture to guess, is a way to define n and n' as co-functions for whatever reasons so that these are not constant under certain criteria of init-call. I think this would involve defining the dyad which is a parameter set for the method in a way that it is or can become (under certain rule(s)) a function. This is all new to me, so maybe someone will comment more about it.

__ Jim

viravan
04-07-2003, 08:49 PM
but is there a definition for a general log to any base


Well, just a wild guess:

LN10=Math.log(10); // base 10
LN2=Math.log(2); // base 2

LOG10E=1/Math.log(10);
LOG2E=1/Math.log(2);


Is that what you're looking for?


:)

V.V.

apezVal
04-07-2003, 09:28 PM
>Is that what you're looking for?

Yes, Virvan...your wild guess is part of the "set" which is the " javascript Math Resource." (But, like what isn't? since it is such a logical system.)
I am not exactly sure (yet) what I am looking for except that I want to use the ansi-alpha-numeric keyboard resource which is the way we define any and all javascripts with a certain individualized set of goals hazily defined at present (innovative DNA modeling ideas mainly,...this is a hot topic in biotech).

I have found this Netscape web-page most informative in this regard:

http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/math.html

And here it states about the 'Math Object':

"Description
All properties and methods of Math are STATIC. You refer to the constant PI as Math.PI and you call the sine function as Math.sin(x), where x is the method's argument. Constants are defined with the full precision of real numbers in JavaScript."

This I tend to belive (in my very basic understanding of js) is not the full picture.
In other words (rebel that I am), I tend to think there are ways and means to make the "returned-STATIC values" the resource for functions ...so that this is not all so 'static.'

Because I know there are ways to set any value X equal to Y by a set of definitions called the "script." This is the basic principle of Algebra (of which there are more than 600 categories as most people hardly know the usual commutative algebra we learn in High School). In a way it amounts to equating the alpha-set (letters of any alphabet) with numbers (or functions of these in an indexing system which in js has to involve the use of "string."

At any rate, I welcome any new ideas about this and in using the keywords "logarithm javascript" at the Google search engine, there is a lot of reading to do!

Thanks,
__ Jim

viravan
04-07-2003, 09:49 PM
Perhaps this is help you in your quest:

From Core Java 2, Volume I--Fundamentals:


Static methods are methods that do not operate on objects. For example, the pow method of the Math class is a static method. The expression:

Math.pow(x,y)

computes x to the power y. It does not use any Math object to carry out its task.....

You use static methods in two situations:

1) When a method doesn't need to access the object state because all needed parameters are supplied as explicit parameters.

2) When a method only needs to access static fields of the class.



:)

V.V.