Page 1 of 1

Simple question : how to do "10 to the power of x"

Posted: Fri Jul 27, 2007 3:24 am
by michel
Hello,
I wonder how to execute a basic mathematical operation :
"10 to the power x" ?

I don't know if my explanation is clear, so I will give some examples :
For example I would like to have the result of "10 to the power of 4" ( = 10000 ) ... or even "5 to th power of 3" ( = 75 ).

I did not find anything in the manual or help for this basic operator, so if you can help me, I would really appreciate.

Thanks in advance.

Posted: Fri Jul 27, 2007 3:49 am
by ArndW
I don't know TX, but usually x**y will do it (at least that will work in server/px) - have you tried that?

Posted: Fri Jul 27, 2007 7:44 am
by michel
Thanks a lot, but I tried it and it did not work in TX. Has anybody another idea, please ?
Thanks in advance.

Posted: Mon Jul 30, 2007 4:54 am
by janhess
At vn 8.1 you can use the POWER function in mathlib

Posted: Mon Jul 30, 2007 9:46 am
by michel
Thanks, but the matter is that we won't upgrade to v8.1 before a long (undetermined) time. So I would really have appreciated a solution in v7.5 ... if somebody knows one !?

Posted: Mon Jul 30, 2007 3:20 pm
by ray.wurlod
If the exponent is integer and small you might be able to multiply in a loop.

Posted: Mon Jul 30, 2007 3:21 pm
by ray.wurlod
If the exponent is integer and small you might be able to multiply in a loop.

Posted: Tue Jul 31, 2007 12:30 am
by vivek
you could use something like 10eX.

Posted: Tue Jul 31, 2007 1:35 am
by michel
Thank you for your help, but "10eX" doesn't work and I can't do a loop (neither make a custom function) in v7.5

Is it a problem without a solution ? ... It would be a pity for such a basic operation ... :cry: ...

If someone else has an idea !? ...

Posted: Wed Sep 19, 2007 8:52 am
by DianeC
Here's how I got it. Input tt has 2 fields - number, exponent
Output tt has 1 field, nbrout (1:s)
Map has 1 input card, 2 output cards (first one set to 'sink'), one Functional map.

1st output card has the nbrout field indexed to get to the 1st occurance, then the rest. nbrout [1], nbrout[2:s] The first occurance gets loaded with the number itself.
nbrout[2:s] is the FMap using an index to compare to the exponent for the looping. The FMap just multiplies the nbrout*number repeatedly until loop condition is met.
"IF ( INDEX($) < Exp Fields:NbrFle, DoFINAL(NumberTst Fields:NbrFle, NbrOut Fields:DtOut))"

The 2nd output card maps the last occurance of the multiple nbrout from the first output card for the answer. nbrout[LAST].

Doing this, I used 2 as the number and 4 as the exponent, got 16 for my output.

Of course if you're working from deeper within a map, you can change it as needed, but you get the idea.