Is there a simple equation for this?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 161
Joined: Tue Feb 23, 2010 10:53 pm

Re: Is there a simple equation for this?

Post by bobcole » Sat Sep 10, 2022 9:01 pm

by stam » Fri Sep 09, 2022 2:22 pm
You may also want to check out some of Roger's excellent stacks:
https://livecodeshare.runrev.com/stack/ ... Boids-2019
https://livecodeshare.runrev.com/stack/ ... -Detection
These are masterful works of art and science. Impressive!

In the LiveCode menu > Sample Stacks:
  • Search for "FlockOBoids" for the 2022 version (updated 9-10-2022); and
  • Search for "Alien" for AlienCivilizationDetection.7.0 (updated 3-30-2022).
Wonderful simulations!
Bob

ajperks
Posts: 105
Joined: Sat Sep 06, 2014 3:38 pm

Re: Is there a simple equation for this?

Post by ajperks » Sun Sep 11, 2022 2:08 pm

Hi Roger, Stam, Craig...
I know this is all early days in development, for me and I went to bed last night pretty pleased that I had the little amoeba (chosen because it has a fixed shape) detecting the target and heading to it for lunch.
I woke up this morning realising I had got it all wrong. It cannot head towards anything because that requires a decision and some intelligence.
The best it can do is detect molecules and react in some way. Honey for example makes a good antiseptic because the sugar disrupts cell membranes.
So, back to the Petri dish.
Instead of heading directly for the target, it can only sense contact with desirable molecules and depending on their intensity (strength of scent), move in that direction.
From what I have noted, cells excrete waste products and this is the trail that is followed.
If the amoeba meets a stream of waste, it can go either upstream to the target or down stream where the scent becomes weaker.
In conclusion, all my work figuring out the algorithm to head to target is now dumped and an easier process needs to be devised.
For me, this is the fun of this project. For me, there is no point in creating some sort of game because cleverer people can do that better.
I will update you when I have some code to show.
Thanks for listening.

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 122
Joined: Fri Apr 28, 2006 12:10 am

Re: Is there a simple equation for this?

Post by RogGuay » Sun Sep 11, 2022 11:16 pm

bobcole wrote:
Sat Sep 10, 2022 9:01 pm
by stam » Fri Sep 09, 2022 2:22 pm
You may also want to check out some of Roger's excellent stacks:
https://livecodeshare.runrev.com/stack/ ... Boids-2019
https://livecodeshare.runrev.com/stack/ ... -Detection
These are masterful works of art and science. Impressive!

In the LiveCode menu > Sample Stacks:
  • Search for "FlockOBoids" for the 2022 version (updated 9-10-2022); and
  • Search for "Alien" for AlienCivilizationDetection.7.0 (updated 3-30-2022).
Wonderful simulations!
Bob
Thank you for your very kind words, Bob.
Roger

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 122
Joined: Fri Apr 28, 2006 12:10 am

Re: Is there a simple equation for this?

Post by RogGuay » Sun Sep 11, 2022 11:50 pm

AJ, I hope you are not getting discouraged as this kind of stuff is great fun and wonderfully rewarding. I think you are on the right track . . . come up with some simple rules and then figure out how to code those rules.

Good luck and keep posting.

Roger

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is there a simple equation for this?

Post by dunbarx » Mon Sep 12, 2022 12:41 am

I am still missing something.

A real cell detects chemicals, and knows in which direction they appear the most concentrated. It then turns toward that direction, moves a bit, and likely smells the medium again.

We do not have a smells command in LC. I will place an enhancement request.

We must, in LC, simulate the fact that the cell knows in which direction its target lies. As I said earlier, we are not cheating when we use LC tools to do that. I do not see any difference at all in the two methods.

Someone tell me why...

Craig

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 122
Joined: Fri Apr 28, 2006 12:10 am

Re: Is there a simple equation for this?

Post by RogGuay » Mon Sep 12, 2022 8:44 pm

dunbarx wrote:
Mon Sep 12, 2022 12:41 am
We must, in LC, simulate the fact that the cell knows in which direction its target lies. As I said earlier, we are not cheating when we use LC tools to do that. I do not see any difference at all in the two methods.

Someone tell me why...

Craig
Craig, FYIW, I agree with you. I'm just laying low because AJ seems to be averse to details of other's work.

Roger

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is there a simple equation for this?

Post by dunbarx » Tue Sep 13, 2022 1:51 pm

AJ.
. It cannot head towards anything because that requires a decision and some intelligence.
Indeed. It requires, in fact, being alive, which means cognizant of its environment. If it has just that alone, the concept of "intelligence" has to be acknowledged to exist within it. It may not be able to program a computer, but it receives messages from outside itself, and acts purposefully.

You and I are certain about exactly one thing. Our own existence. Everything else derives from messages from outside ourselves. These could be dreams. I suspect they are rather more than that, but I am not certain about that.

The amoeba is no different from us at all. We are just more opinionated. :D

Craig

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Is there a simple equation for this?

Post by stam » Tue Sep 13, 2022 3:25 pm

Not sure I agree completely. At a very low level, one cannot ascribe behaviour to “intellect”. By “intellect” I mean being aware of surroundings and have self-determining volition.

Take for example prion proteins or even viruses; these are not within the definition of “alive”, yet exhibit behaviour that can be ascribed to a level of “intellect”. Yet a virus has no knowledge of surroundings and doesn’t aim for a particular cell-receptor to bind to to infect a particular cell. Even the weirder prion proteins can seem to do this..

However in both the above cases the entity in question is just following a fixed set of rules. Most will fail but with numbers on their side they some will succeed in causing specific infections of their host. And I very much doubt a single cell (which is “alive” by biological definition) has an identity of self, opinions, volition.

These are simply rules and behaviours hard-coded into DNA/RNA that have been honed over millions of years of evolution.

In other words a fixed set of behaviours can give the impression of a hunt, but the hunter is not aware of the target as such. It just follows the right set of rules that allow it to hunt and propagate.

If it didn’t it would have gone the way of the Dodo!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is there a simple equation for this?

Post by dunbarx » Tue Sep 13, 2022 5:34 pm

Stam.
the entity in question is just following a fixed set of rules.
Exactly. I also am an entity, albeit with a keyboard, following a fixed set of rules. The only difference is that I like chocolate, and an amoeba don't care. The nature of those rules are neither pertinent nor relevant. Again, I see no distinction at all. Nothing that says my keyboard is somehow unfairly back-room enabled against the poor amoeba's sense of smell.

The mechanics of making an LC control move are also not pertinent. Our controls can neither swim nor smell. The amoeba cannot step through its code. None of that, none, matters.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is there a simple equation for this?

Post by dunbarx » Tue Sep 13, 2022 5:38 pm

I just reread the title of this thread.

It purports to ask for a method of moving one control based on the loc of another. It devolved (degenerated?) into an almost philosophical one. That is fun, and I encourage this sort of thing. But then, AJ, where are we?

Craig

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Is there a simple equation for this?

Post by stam » Tue Sep 13, 2022 7:01 pm

You kind of went a bit metaphysical on us in your penultimate post ;)

I guess the crux of the discussion is:
dunbarx wrote:
Mon Sep 12, 2022 12:41 am
We must, in LC, simulate the fact that the cell knows in which direction its target lies.
this statement isn't strictly speaking correct - the cell in some wayreacts to stimuli in its immediate vicinity, but has no knowledge or notion of the target's direction/location.

And actually what rules you sent in place to achieve chemotaxis (which is what we're talking about here) is complex. Larger eukaryotic cells can detect concentration gradients (eg lymphocytes moving to focus on infection) so one mechanism could be gradient sensing that drives the 'hunter'.

Small cells (eg bacteria) may not be able to directly detect a concentration gradient. Instead, they move over larger distances several times their own width and measure the rate at which perceived chemical concentration changes. Sounds like a hassle, but E. coli thrives on this.

The ideal simulation would involve defining rules for chemotaxis (or negative chemotaxis if moving away from a stimulus) and setting them in motion.
I presume this would then be quite a complex model as you'd need to create both the stimuli (which themselves would have characteristics like 'taste', size, density and duration (one should factor in that a stimulus is not there forever), and then come up with fixed rules as to what the cell does when it encounters these stimuli - but it can't 'set course' for the target as such...

It might be pretty cool to define behaviour for the hunter similar to E. coli, which is very well studied.

A nice summary can be found here: https://en.wikipedia.org/wiki/Chemotaxis

S.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is there a simple equation for this?

Post by dunbarx » Tue Sep 13, 2022 7:44 pm

Stam.

Aha. OK, I see that. I saw a startling video a decade or two ago where a lymphocyte literally chased a bacterium for a good twenty seconds in a convoluted path through all the other cells in the area, until it finally caught up and ate it. No police car chase video was as riveting. It was very very sure which way to go, instant by instant to close the distance. I am not at all sure how often it smelled its environment, but it did not seem that it chose a random direction at any time and took stock. Of course, it may have at a faster rate and with smaller turns than I could detect,

The simulation is still basically the same, but now we must move at random just a bit and check to see if the shortest distance to the target lunch increases or decreases. This might require a few steps, smelling along the way, and logging that distance. If the distance decreases over a couple of steps, then we are simulating the amoeba detecting a series of higher concentration gradients, and make it turn in the best direction, which we now know.

But if it increases, then we are simulating the amoeba detecting a lower concentration gradient, and make it turn opposite to its last series of turns.

I do see this enhanced simulation as more realistic. But I still see its core methodology as the same, just more refined.

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Is there a simple equation for this?

Post by bn » Tue Sep 13, 2022 9:23 pm

Ah... Cellular Migration

https://pubmed.ncbi.nlm.nih.gov/?term=% ... nker%29%29

Revolution/Livecode helped a lot with that

Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is there a simple equation for this?

Post by dunbarx » Tue Sep 13, 2022 9:53 pm

Bernd.

Cool.

But where is the LC reference?

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Is there a simple equation for this?

Post by bn » Tue Sep 13, 2022 10:10 pm

dunbarx wrote:
Tue Sep 13, 2022 9:53 pm
But where is the LC reference?
Craig
I developed a LC solution for cell tracking (manually since we worked in 3-D collagen matrix which automated cell tracker have trouble tracking)
And a whole workflow from recording to results which involved LC among other apps. Filemaker, Applescript, surveillance software (for recording over 16 hours in timelapse)
Without LC we could not have done it in the smooth way we eventually did it. When I left for retirement we had 22000 recordings of migratory experiments which were instantly available via a Filemaker database.

As far as cellular migration is concerned my take on it is that many simplified assumptions about migration come from highly artificial culture dish experiments. In "real life" there is not such thing as a 2-dimensional world in which cells/bakteria live.
As an example: you see beautiful pictures of Lymphozytes in a culture dish: they exhibit so called stress fibres. You never see stress fibres in a migrating Lymphozyte in 3-D collagen lattice.

Nevertheless I find trying to model bacterial/cellular migration a worthwile undertaking.

Kind regards
Bernd

Post Reply