Page 2 of 2 <12
Topic Options
#112488 - 2004-01-27 10:37 PM Re: Enhanced Math - power of n
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Thanks for the reply/feedback Jack. My testing shows that the returned values are not correct.

Top
#112489 - 2004-01-27 10:55 PM Re: Enhanced Math - power of n
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Math.Exp(d)

Returns e raised to d.

I have no idea what this exp/e thingy is, but is it a good thing and should we be adding it ?

Top
#112490 - 2004-01-27 10:58 PM Re: Enhanced Math - power of n
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Shawn

The line

$t = $Math.log($b)*$e

is not working. It seems to be returning a null string. The "exp" function is the inverse of the log function & yes it is e=2.718281828 raised to the power $t.


Edited by Jack Lothian (2004-01-27 11:00 PM)
_________________________
Jack

Top
#112491 - 2004-01-27 11:05 PM Re: Enhanced Math - power of n
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Let me try here, there are a couple of special builds floating around, pre-releases ...

so if i try this:


$e = 2.718281828

$t = $Math.log($b) * $e

?"t=" $t

what value should I use for $b ? anything ?

Top
#112492 - 2004-01-27 11:08 PM Re: Enhanced Math - power of n
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
let

$e=3.3

$b = 2.718281828

$t = $Math.log($b) * $e

Then $t = $e = 3.3

Don't confuse my $e with "e". I used $e because it was the exponent. Has nothing to do with "e=2.718281828"

I just feed the above lines

$e=-2.2
$b=6.3

and I got $t= (i.e. a null return)


Edited by Jack Lothian (2004-01-27 11:11 PM)
_________________________
Jack

Top
#112493 - 2004-01-27 11:11 PM Re: Enhanced Math - power of n
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Just ran your code as spec'd ... yields:

t = 3.29999999944272

Is this good or bad ? Heres the code:

Code:

$System = CreateObject("Kixtart.System")

$Math = $System.Math()

$e = 3.3

$b = 2.718281828

$t = $Math.log($b) * $e

?"t = " $t




-Shawn

Top
#112494 - 2004-01-27 11:14 PM Re: Enhanced Math - power of n
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
If $e=-2.2 and $b=6.3 then $t should equal -4.04921

and exp($t) should equal 0.017436

Oops Shawn, I should have read your post more carefully. Trying to do 2 things at the same time doesn't work. What you got is good. Within the accuracy of the function you returned "3.3". This is good.

Maybe you have a newer version of kixform then I have. The same line seems to return nothing for me.

NTDOC,

I fixed a foolish coding error in the function but I doubt this was the issue.


Edited by Jack Lothian (2004-01-27 11:22 PM)
_________________________
Jack

Top
#112495 - 2004-01-27 11:20 PM Re: Enhanced Math - power of n
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
with revised nums:

t = -4.04920919347447

Do you think Exp() is a good candidate for a core Math function library (should we add it?)

-Shawn

Top
#112496 - 2004-01-27 11:24 PM Re: Enhanced Math - power of n
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Shawn,

If you want to create a generic power function as NTDOC requested then it is an absolute necessity. Simple answer - yes.

Ah. I think I am getting it. You haven't implemented these functions yet??


Edited by Jack Lothian (2004-01-27 11:34 PM)
_________________________
Jack

Top
#112497 - 2004-01-27 11:24 PM Re: Enhanced Math - power of n
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Just ran this through Matlab 6.5.1 and get the following (15 digit fixed precision or floating point, whichever is better):
Code:

e=-2.2
b=6.3
t=log(b)*e

t = -4.04920919347447

exp(t)

ans = 0.01743615781624

_________________________
There are two types of vessels, submarines and targets.

Top
#112498 - 2004-01-27 11:50 PM Re: Enhanced Math - power of n
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ja, right now KF has these functions:

COS()
LOG()
LOG10()
POW()
SIN()
SQRT()

And I dont really want to implement every single possible math function known to man (in this release ... I will take it on your expert opinion that Exp is a good thing to add. You are a Math teacher after all, ja ?



Top
#112499 - 2004-01-28 12:03 AM Re: Enhanced Math - power of n
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
In another life, I taught math at a university (in Edmonton) but today I am Survey Methodologist at Statscan. I do have a lot to do with schools though. My wife is a principal, my daughter & my brother are teachers & I was a big time volunteer at our local schools for about 10 years & I was on our local School Board's tech committee for several years. (This is how I got involved with kixtart - I helped set the computer system in my kids middle school when they wired all the classrooms. Even though I don't use kixtart a lot anymore, I keep coming back because of the nice people here.)

PS: Your list of functions plus exp looks good to me. With these functions plus the ones already in Kixtart you can do an awful lot.


Edited by Jack Lothian (2004-01-28 12:12 AM)
_________________________
Jack

Top
#112500 - 2004-01-28 12:14 AM Re: Enhanced Math - power of n
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
STATSCAN, thats right - you mentioned that before. STATSCAN is one part of the GOV'T that I have no issues with. I even dutifully sign over my "information" to STATSCAN on my T4 (i think its to STATSCAN) ... Can't say the same thingy for the MTO right now - they're a bunch of basta's !

Ok - so EXP() is in there now ... the Math library is nearing completion - bwa-ha-haaa !!!

Anything else you could recommend Jack ?

Top
#112501 - 2004-01-28 04:17 PM Re: Enhanced Math - power of n
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I have to agree with Jack. Using the afore-mentioned math (basic/trigonometric) functions, one create other more complex functions as UDFs if necessary. However, I do have one request though, can you also throw in some bit-wise and binary operators, like NOT/AND/OR/XOR such as
Code:

C = BITAND(A,B) returns the bit-wise AND of the two arguments
C = BITCMP(A,N) returns the bit-wise complement of A as an N-bit non-negative integer
C = BITOR(A,B) returns the bit-wise OR of the two arguments A and B
C = BITXOR(A,B) returns the bit-wise exclusive OR of the two arguments A and B
C = BITSET(A,BIT,V) sets the bit at position BIT to the value V
C = BITGET(A,BIT) returns the value of the bit at position BIT in A
C = BITSHIFT(A,K,N) returns the value of A shifted by K bits. Shifting by K is the same as multiplication by
2^K and then rounding to the nearest integer (i.e. C = fix(A*2^K)). If the shift causes
C to overflow N bits, the overflowing bits are dropped
C = XOR(S,T) is the logical symmetric difference of elements S and T. The result is one where either S or T,
but not both, is nonzero. The result is zero where S and T are both zero or nonzero.



BTW, it seems that Jacks clain to fame are these two articles:
Quote:


Lothian, J. and Morry, M. (1977). The problem of aggregation: direct or indirect seasonal adjustment. Research paper 77-08-001E, Seasonal Adjustment and Time Series Staff, Statistics Canada.

Lothian, J. and Morry, M. (1978). A test for the presence of identifiable seasonality when using the X-11 program. Research paper 78-10-002E, Seasonal Adjustment and Time Series Staff, Statistics Canada.





Edited by sealeopard (2004-01-28 04:22 PM)
_________________________
There are two types of vessels, submarines and targets.

Top
#112502 - 2004-01-28 07:22 PM Re: Enhanced Math - power of n
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
I have other papers but these 2 are probably the most requested. All the others are equally esoteric though so I don’t think they will make me famous.

thanks to your findings Jens, I decided to search for my name on the web & I discovered that something called "the Lothian method" exists. Amazing, never knew that I had something named after me. For those interested in reviewing an indication of my celebrity status just search this page for my name.

The Lothian Method





Edited by Jack Lothian (2004-01-28 07:51 PM)
_________________________
Jack

Top
#112503 - 2004-01-28 08:08 PM Re: Enhanced Math - power of n
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
From http://www.googlism.com
Quote:


Googlism for: jack lothian

jack lothian is a unique and enviable one for many of our readers




_________________________
There are two types of vessels, submarines and targets.

Top
#112504 - 2004-01-29 09:54 AM Re: Enhanced Math - power of n
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
And these

http://lib.stat.cmu.edu/joint94/Abstracts/0343
http://66.102.7.104/search?q=cache:x6sNIOZzTqQJ:strategis.ic.gc.ca/epic/internet/ineas-aes.nsf/vwapj/wp04e.pdf/%24FILE/wp04e.pdf+"jack+lothian"&hl=en&ie=UTF-8
http://66.102.7.104/search?q=cache:7Z7Jeb_NjhgJ:publish.uwo.ca/~mbgreen/control.pdf+"jack+lothian"&hl=en&ie=UTF-8


Top
Page 2 of 2 <12


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 165 anonymous users online.
Newest Members
MaikSimon, kvn317, kixtarts2025, SERoyalty, mytar
17872 Registered Users

Generated in 0.055 seconds in which 0.02 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org