Darwinbots Forum
Welcome To Darwinbots => Newbie => Topic started by: Botsareus on April 14, 2009, 01:09:58 PM
-
Is there a command (call it “unpow”) that does the vb equivalent of “a ^ (1/b)”?
For example:
64
3
unpow
puts 4 on top of the stack
-
Yep, never mind, the answer is "NO". ( I just realised I have been trough this before)
If we really want to get going with this stuff we might as well add a command (call it “depow”) that does the vb equivalent of “Log(a) / Log(b)"
For example:
64
4
depow
puts 3 on top of the stack
-
What you could do is use an approximation of log (http://en.wikipedia.org/wiki/Logarithm#Series_for_calculating_the_natural_logarithm), wouldn't exactly be nice and clean however
Also for your first one do you really need a single operator for that?
64 1 3 div pow
This works just fine.
-
Really? I guess it was a change Eric made. Back in the day 1 3 div 3 mult would have been 0 from integer rounding errors.
-
Really? I guess it was a change Eric made. Back in the day 1 3 div 3 mult would have been 0 from integer rounding errors.
Oh... actually no, its returns 1 (which makes sense if there are rounding errors). I was under several assumptions, including that it would work because the math works sorry
-
I remember Eric talked about it once, so it wouldn't have surprised me. Mostly I objected to the idea, because floating point is a whole can of worms with how it works.
-
That is why I suggest we skip the floating point bull and do the calculations internally:
“Log(a) / Log(b)" means "depow"
“a ^ (1/b)” means "unpow"
a
b
depow
a
b
unpow
This way the result will be an approximate whole but there will be no need for floating points in the DB code.
And yes my names need improvement: I don't think "unpow" and "depow" sounds professional enough.
P.S.
O yea, and I believe this topic belongs in the suggestions forum now...
Thank You for your time...
-
I think a general pow term actually isn't a great idea. There's very little need to raise things to powers other than 1/3, 1/2, 2, or 3. So I think a better solution would be to add cbrt, cube, and square commands. Or something along those lines.
-
I have already added unpow and depow to my DB source code...
So If my evolved robot uses it I will have to post the vb code I changed. It's two new subs called DNAunpow and DNAdepow. DNA tokenizing and detokenizing was changed. etc.
-
Just out of curiosity, what were you planning to use this for?
-
I hope that it will add more flexibility to my evolving robots. I don't plan to write my own robot, I am working on a system to generate a robot good enough for F1 mode...
-
I hope that it will add more flexibility to my evolving robots. I don't plan to write my own robot, I am working on a system to generate a robot good enough for F1 mode...
You know, I think the whole concept of Darwinbots began around that idea. The thought that you can evolve a better bot, no matter how good the current one may be. At least in my mind, that is what is so exciting.