### neuro sim -- sneak peak

After a very long time, this project is nearing completion. Take a peak and let us know what you think:

Neuromuscular Junction with Flash

On the dev side, it's a hybrid of actionscript and tweens.

« December 2002 | Main | February 2003 »

After a very long time, this project is nearing completion. Take a peak and let us know what you think:

Neuromuscular Junction with Flash

On the dev side, it's a hybrid of actionscript and tweens.

Most of my flash work lives in the first frame. But today, I'm working with a movieclip's timeline. I kept trying to change the value of a global variable, declared on the main timeline, from the last frame of my movieclip. No luck.

Then I referenced the variable as _root.variable. Eureka!

I'm just thinking outloud, here...puzzling over how to approach part of a complex project.

Problem: A simulation with three steps, which must play in sequence. Under different treatments, selected by the user, each step may differ. Look up what should happen when at each step, for a treatment. How do I store this info in a way that can be easily looked up with same method each time?

First, I thought about arrays. Something like

simPlot = newArray[[normal, 1,1,1], [spider,1,0,0],...];

That could work, but there are several treatments, and it's hard for me to keep track of index numbers for each, when calling for the values in another function.

I was looking up info on Arrays at Helen Triolo's actionscript-toolbox. That gave me the idea to use a string for saving the simulation plot, and then use "split" and read the data like an array:

normalSim = "1:1:1"; // normal: fire action potential, release ACh, contract muscle

snakeSim = "0:0:0"; // snake: no current, no ACh release, no contraction of muscle

Then write a general function for getting the plot for any condition (treatment):

getPlot = function(treatment){

simPlot = treatment.split(":"); // split string to array of steps for this treatment

trace(simPlot[0]); //what is first step?

}

Then, when it's time to run that part of the simulation, call:

getPlot(normalSim);

Well, I'm going to try this out now.

Design Science publishes a newsletter every six months containing the latest news for computing and visualizing math on the web. I thought I would provide a link for this valuable resource in case our members were not aware of this site.

Wow! Flashgoddes selected both of our Periodic Table projects: the webMathematica-Flash integration and the spelling game.

Check out the review...

2002 was quite a year for GalaxyGoo, and 2003 promises even more.

In the next few weeks, we'll launch our Science Interview program. After some additional testing, we'll clear the trivial questions currently in the database, and replace them with the real interview quesitons.

I've compiled a selection of extensions for the Math object which includes 4 new constants and 50 new functions to compliment the core Math object constants and methods. I may add to these in future, so note the version number for updates.

To use, copy MathExtensions1.1.as to:

C:\Program Files\Macromedia\Flash MX\Configuration\Include (on PC),

then include the .as file in future scripts without the need for a path:

#include "MathExtensions1.1.as"

At the bottom of the file you'll find a synopsis of the Math object constants and methods, and the Math object extensions of constants and functions, including method/function arguments, displaying an overview for quick application in your scripts. I'll include the list here for your perusal:

////////////////////////////////// Math Object

Constants

1 - **E** - natural log - Euler's number - 2.71828182845905

2 - **LN2** - natural log of 2 - 0.69314718055994528623

3 - **LN10** - natural log of 10 - 2.3025850929940459011

4 - **LOG2E** - base 2 of natural log (E) - 1.442695040888963387

5 - **LOG10E** - base 10 of natural log (E) - 0.43429448190325181667

6 - **PI** - ratio of circumference to diameter of a circle - 3.14159265358979

7 - **SQRT1_2** - squareroot of 1/2 - 0.707106781186

8 - **SQRT2** - squareroot of 2 - 1.414213562373

Methods

1 - **abs(x)** - absolute number

2 - **acos(x)** - arccosine of "x"

3 - **asin(x)** - arcsine of "x"

4 - **atan(x)** - arctangent (0-90°)

5 - **atan2(y,x)** - arctangent (0-180°)

6 - **ceil(x)** - ceiling - smallest integer above "x"

7 - **cos(x)** - cosine of "x"

8 - **exp(x)** - exponential - "E" to the power of "x"

9 - **floor(x)** - floor - greatest integer below "x"

10 - **log(x)** - natural log of "x"

11 - **max(x,y)** - compare "x" and "y" for maximum

12 - **min(x,y)** - compare "x" and "y" for minimum

13 - **pow(x,y)** - "x" to the power of "y"

14 - **random()** - random floating point number between 0-1

15 - **round(x)** - round floating point number to integer based on .5 split

16 - **sin(x)** - sine of "x"

17 - **sqrt(x)** - squareroot of "x"

18 - **tan(x)** - tangent of "x"

////////////////////////////////// Math Object Extensions

Constants

1 - **DEG2RAD** - convert degrees to radians - 0.0174532925199433

2 - **RAD2DEG** - convert radians to degrees - 57.2957795130823

3 - **PHI** - the golden mean - 1.61803398874989

4 - **LAMBDA** - Euler-Mascheroni constant - .5772156649

Functions

1 - **sec(angle)** - secant

2 - **asec(ratio)** - arcsecant

3 - **csc(angle)** - cosecant

4 - **acsc(ratio)** - arccoseceant

5 - **cot(angle)** - cotangent

6 - **acot(ratio)** - arccotangent

7 - **sinh(n)** - hyperbolic sine

8 - **asinh(n)** - hyperbolic arcsine

9 - **cosh(n)** - hyperbolic cosine

10 - **acosh(n)** - hyperbolic arccosine

11 - **tanh(n)** - hyperbolic tangent

12 - **atanh(n)** - hyperbolic arctangent

13 - **sech(n)** - hyperbolic secant

14 - **asech(n)** - hyperbolic arcsecant

15 - **csch(n)** - hyperbolic cosecant

16 - **acsch(n)** - hyperbolic arccosecant

17 - **coth(n)** - hyperbolic cotangent

18 - **acoth(n)** - hyperbolic arccotangent

19 - **ln(n)** - natural logarithm of parameter "n"

20 - **log_a(a,n)** - logarithm base "a" of "n"

21 - **sign(n)** - sign of a number

22 - **placesRound(a,b)** - rounds "a" to "b" decimal places

23 - **randomBetween(a,b)** - random number between "a" and "b"

24 - **summation(n,x)** - sum of all numbers between 1 and "n" raised to "x" power

25 - **square(n)** - number squared

26 - **inverse(n)** - number inversed

27 - **fp(n)** - decimal portion of floating point number

28 - **pow2(a,n)** - solves the negative value input bug

29 - **nRoot(a,n)** - nth root of a number

30 - **factorial(n)** - factorial of a positive integer

31 - **permutations(n,r)** - number of ways to arrange a list - order matters

32 - **combinations(n,r)** - number of ways to arrange a list - order doesn't matter

33 - **isPrime(n)** - boolean for prime integer

34 - **isEven(n)** - boolean for even integer

35 - **isOdd(n)** - boolean for odd integer

36 - **gcd(a,b)** - greatest common divisor

37 - **lcm(a,b)** - lowest common multiple

38 - **percentage(a,b)** - convert fraction to percentage

39 - **mean(arr)** - mean of array

40 - **variance(arr)** - variance of array

41 - **sd(arr)** - standard deviation of array

42 - **distance(x1,y1,x2,y2)** - distance between 2 points

43 - **angle(x1,y1,x2,y2)** - angle of line in degrees

44 - **angle2Standard(angle)** - Flash angle to standard geometric angle

45 - **polygonArea(arr,len)** - area for convex and concave polygons

46 - **toPoint(vec)** - convert vector tail to Cartesian coordinates

47 - **toPolar(vec)** - convert vector to polar coordinates

48 - **round2(num)** - rounds negative numbers down

49 - **formatDecimals(num,digits)** - format number to specified decimals and 0 pad right

50 - **toScientific(num,sigDigs)** - scientific notation to specified significant digits