Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#226409 - 11/07/2004 00:48 fun little project i've been working on
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
I've been playing around with animating the relative weight of the terms of mathematical equations by adjusting their font size of those terms. It sort of ends up being a visualization of Big-O notation in that you can see what terms because meaningful / meaningless as the index increases. There's no equation editor yet, since I haven't brought over my equation parser from jEmplode, but you can play with the sample equation that I have in there.

Not sure what the minimum VM is that you need for this to work ... I'm running 1.4, though.

http://www.inzyme.com/equation/index.html

Top
#226410 - 11/07/2004 02:26 Re: fun little project i've been working on [Re: mschrag]
RobotCaleb
pooh-bah

Registered: 15/01/2002
Posts: 1866
Loc: Austin
thats really neat. can i ask for a more in-depth explanation?

Top
#226411 - 11/07/2004 03:02 Re: fun little project i've been working on [Re: RobotCaleb]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
Sure -- Basically I represent the equation as a tree where I have something like:

addition(power(x, 2), multiplication(x, sin(x)))

then I choose a value for all of the variables -- say, x=2, and evaluate each of the tree nodes. So at the leaves of the tree there is either a variable or a constant. When I go to render the equation, for each render node, I apply a scaling transform that is a function of the value of that node (basically you can evaluate each branch of the tree as if it were standalone) and the highest value of all of its children (that second part is so i don't "double count" the scale factors as they go up the tree). So because it's a tree, the scaling transforms compound, so the most influential branches of the tree because large while th\e less influential parts of the tree become small. The animation is basically incrementing the input values and recomputing the weights for each value.

So essentially what happens is if you have x^2 + 2*x, the x's are of equal weight, but the x^2 is x/2 times more influential than the 2*x factor, so as x increases, you see the x^2 dominate the visualization.

Incidentally, one curious issue I've been working on is that I evaluate essentially like order of ops, so if I have (x + 5 + x), it's evaluated as ((x+ 5) + x), so the first term is (x + 5) and is 5 units larger than the second x, so it looks slightly larger than than the second x. I avoid this currently by ignoring computing the rolled up scale factor for an addition. It's less noticable for multiplication sense multiplication usually has a larger influence anyway, so you don't notice the small initial differences like you do with addition which works "more slowly". I've always been debating about how to handle function notation like sin(x). Currently I scale the function variable, but I'm thinking I shouldn't. In general, you can't know what kind of affect the function parameters will have on the output, so it's slightly misleading to make it appear that the parameter is influential. For instance, high values of x for sin(x) aren't any more influential than small values of x since sin(x) is bounded.

This is mostly useless, it was just a fun program to write. That and the equation renderer is kind of cool

ms

Top
#226412 - 11/07/2004 03:05 Re: fun little project i've been working on [Re: mschrag]
RobotCaleb
pooh-bah

Registered: 15/01/2002
Posts: 1866
Loc: Austin
i got a kick out of it. thanks for the explanation

Top
#226413 - 11/07/2004 04:21 Re: fun little project i've been working on [Re: RobotCaleb]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
there's a new version up there that lets you put in other formulas if my explanation wasn't clear, hopefuly playing around it will become clearer ... The parser is really lame, but I just put it in there to have something. You may need to clear your cache to get the applet to reload.

Top
#226414 - 11/07/2004 06:03 Re: fun little project i've been working on [Re: mschrag]
RobotCaleb
pooh-bah

Registered: 15/01/2002
Posts: 1866
Loc: Austin
i am having a lot of fun with this. i cant come up with any creative formulas to punch in, but it is still a blast.
anyone have any neat results from certain formulas and step combinations?

Top
#226415 - 11/07/2004 15:09 Re: fun little project i've been working on [Re: RobotCaleb]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
I put some links on that page to a couple equations I use for testing ... You probably have to kill your cache to get the applet to reload properly.

Top
#226416 - 11/07/2004 15:17 Re: fun little project i've been working on [Re: RobotCaleb]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
In particular, I think Multiply(Multiply(cos(x),sin(x)),cos(x)) is kind of cool ... any of the ones with sin/cos do cool things. I would set your step size to a multiple of PI -- makes it smoother. For instance, I use 0.031415. Step size is the far right hand text field (it determines how much x increments for each frame)

Top
#226417 - 12/07/2004 16:01 Re: fun little project i've been working on [Re: mschrag]
trs24
old hand

Registered: 20/03/2002
Posts: 729
Loc: Palo Alto, CA
Very cool! When your applet first loaded I had a flashback to 1986 and the equation making software on our old Mac Plus... I can't remember what it was called, though. Invariably it was something like "Mac-formula."
_________________________
- trs

Top
#226418 - 12/07/2004 16:21 Re: fun little project i've been working on [Re: trs24]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
Weird ... someone I work with mentioned this exact same thing when I sent them the link.

Top
#226419 - 12/07/2004 22:36 Re: fun little project i've been working on [Re: mschrag]
FireFox31
pooh-bah

Registered: 19/09/2002
Posts: 2494
Loc: East Coast, USA
Wow, that is honestly really cool. (little thought balloon over my head as I watched it: "Ooh, growy shrinky letters!!")

Seriously, that could be a tool to help people learn that mathmatical concept. It would benefit people (like me) who learn more visually and less by staring at a book all day. You could submit that to universities for use in their early level math courses or something.

Good work!
_________________________
-
FireFox31
110gig MKIIa (30+80), Eutronix lights, 32 meg stacked RAM, Filener orange gel lens, Greenlights Lit Buttons green set

Top
#226420 - 13/07/2004 09:01 Re: fun little project i've been working on [Re: mschrag]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Doesn't work on my machine XP Pro SP1 + most of the latest IE updates. This is the error I get here:



Attachments
225812-mschragerror.gif (107 downloads)



Edited by Shonky (13/07/2004 09:02)
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#226421 - 13/07/2004 09:14 Re: fun little project i've been working on [Re: Shonky]
JaBZ
addict

Registered: 08/08/2001
Posts: 452
Loc: NZ
I can help you... here

Top
#226422 - 13/07/2004 11:16 Re: fun little project i've been working on [Re: Shonky]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
Do you have a relative recent JVM installed and do you have it set as the handler for the applet tag under tools=>internet options=>advanced? If not, go grab one at http://www.java.com .

Top
#226423 - 13/07/2004 18:16 Re: fun little project i've been working on [Re: Shonky]
tanstaafl.
carpal tunnel

Registered: 08/07/1999
Posts: 5546
Loc: Ajijic, Mexico
This is the error I get here:


You should have seen me just now... wondering why I had that stupid Internet Explorer error message, then cursing because apparently my computer was locked up because I couldn't close that error box or hide details or anything...

tanstaafl.
_________________________
"There Ain't No Such Thing As A Free Lunch"

Top
#226424 - 14/07/2004 12:41 Re: fun little project i've been working on [Re: Shonky]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA

Top