Re: Lemniscate Polygon

2021-11-03 Thread Bob Sneidar via use-livecode
Ok, you googled that, didn't you?? ;-)

Bob S


> On Nov 3, 2021, at 24:29 , Mark Waddingham via use-livecode 
>  wrote:
> 
> Hi Roger,
> 
> On 2021-11-02 22:27, Roger Guay via use-livecode wrote:
>> Dear List,
>> Bernd has produced an absolutely beautiful animation using a
>> Lemniskate polygon that was previously provided by Hermann Hoch. Can
>> anyone provide some help on how to create this polygon mathematically?
>> Since the equation for a Lemniskate involves the SqRt of negative
>> numbers, which is not allowed in LC, I am stumped.
>> You can find Bernd’s animation here:
>> https://forums.livecode.com/viewtopic.php?f=10=36412
>> 
> 
> In general lemniscates are defined as the roots of a specific kind of quartic 
> (power four) polynomials of the pattern:
> 
>(x^2 + y^2)^2 - cx^2 - dy^2 = 0
> 
> So the algorithms for solving them you are probably finding are more general 
> 'quartic polynomial' solvers - just like solving quadratic equations, the 
> full set of solutions can only be computed if you flip into the complex plane 
> (i.e. where sqrt(-1) exists) rather than the real plane.
> 
> However, there is at least one type of Lemniscate for which there is a nice 
> parametric form - Bernoulli's lemniscate, which is a slightly simpler 
> equation:
> 
>(x^2 + y^2)^2 - 2a^2(x^2 - y^2) = 0
> 
> According to https://mathworld.wolfram.com/Lemniscate.html, this can be 
> parameterized as:
> 
>x = (a * cos(t)) / (1 + sin(t)^2)
> 
>y = (a * sin(t) * cos(t)) / (1 + sin(t)^2)
> 
> Its not clear what the range of t is from the article, but I suspect it will 
> be -pi <= t <= pi (or any 2*pi length range).
> 
> So a simple repeat loop where N is the number of steps you want to take, and 
> A is the 'scale' of the lemniscate should give you the points you want:
> 
>repeat with t = -pi to pi step (2*pi / N)
>   put A * cos(t) / (1 + sin(t)^2) into X
>   put A * sin(t) * cos(t) / (1 + sin(t)^2) into Y
>   put X, Y & return after POINTS
>end repeat
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-03 Thread Roger Guay via use-livecode
And thank you, Richmond for implementing what for me was overnight. Very nice 
clean and simple code too!!

Roger

> On Nov 3, 2021, at 1:39 AM, Richmond via use-livecode 
>  wrote:
> 
> https://forums.livecode.com/viewtopic.php?f=7=36429
> 
> Richmond.
> 
> On 3.11.21 9:29, Mark Waddingham via use-livecode wrote:
>> Hi Roger,
>> 
>> On 2021-11-02 22:27, Roger Guay via use-livecode wrote:
>>> Dear List,
>>> 
>>> Bernd has produced an absolutely beautiful animation using a
>>> Lemniskate polygon that was previously provided by Hermann Hoch. Can
>>> anyone provide some help on how to create this polygon mathematically?
>>> Since the equation for a Lemniskate involves the SqRt of negative
>>> numbers, which is not allowed in LC, I am stumped.
>>> 
>>> You can find Bernd’s animation here:
>>> https://forums.livecode.com/viewtopic.php?f=10=36412
>>> 
>> 
>> In general lemniscates are defined as the roots of a specific kind of 
>> quartic (power four) polynomials of the pattern:
>> 
>> (x^2 + y^2)^2 - cx^2 - dy^2 = 0
>> 
>> So the algorithms for solving them you are probably finding are more general 
>> 'quartic polynomial' solvers - just like solving quadratic equations, the 
>> full set of solutions can only be computed if you flip into the complex 
>> plane (i.e. where sqrt(-1) exists) rather than the real plane.
>> 
>> However, there is at least one type of Lemniscate for which there is a nice 
>> parametric form - Bernoulli's lemniscate, which is a slightly simpler 
>> equation:
>> 
>> (x^2 + y^2)^2 - 2a^2(x^2 - y^2) = 0
>> 
>> According to https://mathworld.wolfram.com/Lemniscate.html, this can be 
>> parameterized as:
>> 
>> x = (a * cos(t)) / (1 + sin(t)^2)
>> 
>> y = (a * sin(t) * cos(t)) / (1 + sin(t)^2)
>> 
>> Its not clear what the range of t is from the article, but I suspect it will 
>> be -pi <= t <= pi (or any 2*pi length range).
>> 
>> So a simple repeat loop where N is the number of steps you want to take, and 
>> A is the 'scale' of the lemniscate should give you the points you want:
>> 
>> repeat with t = -pi to pi step (2*pi / N)
>>put A * cos(t) / (1 + sin(t)^2) into X
>>put A * sin(t) * cos(t) / (1 + sin(t)^2) into Y
>>put X, Y & return after POINTS
>> end repeat
>> 
>> Warmest Regards,
>> 
>> Mark.
>> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-03 Thread Roger Guay via use-livecode
Thank you, Mark. That was exactly the answer I was looking for!

Roger

> On Nov 3, 2021, at 12:29 AM, Mark Waddingham via use-livecode 
>  wrote:
> 
> Hi Roger,
> 
> On 2021-11-02 22:27, Roger Guay via use-livecode wrote:
>> Dear List,
>> Bernd has produced an absolutely beautiful animation using a
>> Lemniskate polygon that was previously provided by Hermann Hoch. Can
>> anyone provide some help on how to create this polygon mathematically?
>> Since the equation for a Lemniskate involves the SqRt of negative
>> numbers, which is not allowed in LC, I am stumped.
>> You can find Bernd’s animation here:
>> https://forums.livecode.com/viewtopic.php?f=10=36412
>> 
> 
> In general lemniscates are defined as the roots of a specific kind of quartic 
> (power four) polynomials of the pattern:
> 
>(x^2 + y^2)^2 - cx^2 - dy^2 = 0
> 
> So the algorithms for solving them you are probably finding are more general 
> 'quartic polynomial' solvers - just like solving quadratic equations, the 
> full set of solutions can only be computed if you flip into the complex plane 
> (i.e. where sqrt(-1) exists) rather than the real plane.
> 
> However, there is at least one type of Lemniscate for which there is a nice 
> parametric form - Bernoulli's lemniscate, which is a slightly simpler 
> equation:
> 
>(x^2 + y^2)^2 - 2a^2(x^2 - y^2) = 0
> 
> According to https://mathworld.wolfram.com/Lemniscate.html, this can be 
> parameterized as:
> 
>x = (a * cos(t)) / (1 + sin(t)^2)
> 
>y = (a * sin(t) * cos(t)) / (1 + sin(t)^2)
> 
> Its not clear what the range of t is from the article, but I suspect it will 
> be -pi <= t <= pi (or any 2*pi length range).
> 
> So a simple repeat loop where N is the number of steps you want to take, and 
> A is the 'scale' of the lemniscate should give you the points you want:
> 
>repeat with t = -pi to pi step (2*pi / N)
>   put A * cos(t) / (1 + sin(t)^2) into X
>   put A * sin(t) * cos(t) / (1 + sin(t)^2) into Y
>   put X, Y & return after POINTS
>end repeat
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-03 Thread Richmond via use-livecode

https://forums.livecode.com/viewtopic.php?f=7=36429

Richmond.

On 3.11.21 9:29, Mark Waddingham via use-livecode wrote:

Hi Roger,

On 2021-11-02 22:27, Roger Guay via use-livecode wrote:

Dear List,

Bernd has produced an absolutely beautiful animation using a
Lemniskate polygon that was previously provided by Hermann Hoch. Can
anyone provide some help on how to create this polygon mathematically?
Since the equation for a Lemniskate involves the SqRt of negative
numbers, which is not allowed in LC, I am stumped.

You can find Bernd’s animation here:
https://forums.livecode.com/viewtopic.php?f=10=36412



In general lemniscates are defined as the roots of a specific kind of 
quartic (power four) polynomials of the pattern:


    (x^2 + y^2)^2 - cx^2 - dy^2 = 0

So the algorithms for solving them you are probably finding are more 
general 'quartic polynomial' solvers - just like solving quadratic 
equations, the full set of solutions can only be computed if you flip 
into the complex plane (i.e. where sqrt(-1) exists) rather than the 
real plane.


However, there is at least one type of Lemniscate for which there is a 
nice parametric form - Bernoulli's lemniscate, which is a slightly 
simpler equation:


    (x^2 + y^2)^2 - 2a^2(x^2 - y^2) = 0

According to https://mathworld.wolfram.com/Lemniscate.html, this can 
be parameterized as:


    x = (a * cos(t)) / (1 + sin(t)^2)

    y = (a * sin(t) * cos(t)) / (1 + sin(t)^2)

Its not clear what the range of t is from the article, but I suspect 
it will be -pi <= t <= pi (or any 2*pi length range).


So a simple repeat loop where N is the number of steps you want to 
take, and A is the 'scale' of the lemniscate should give you the 
points you want:


    repeat with t = -pi to pi step (2*pi / N)
   put A * cos(t) / (1 + sin(t)^2) into X
   put A * sin(t) * cos(t) / (1 + sin(t)^2) into Y
   put X, Y & return after POINTS
    end repeat

Warmest Regards,

Mark.




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-03 Thread Richmond via use-livecode

Hmm: didn't like

putA * cos(t) / (1 + sin(t)^2) intoX

at all.

Mainly because A had not been defined . . .


OK: all hunky-dory with  put 200 into A

Richmond


On 3.11.21 9:29, Mark Waddingham via use-livecode wrote:

Hi Roger,

On 2021-11-02 22:27, Roger Guay via use-livecode wrote:

Dear List,

Bernd has produced an absolutely beautiful animation using a
Lemniskate polygon that was previously provided by Hermann Hoch. Can
anyone provide some help on how to create this polygon mathematically?
Since the equation for a Lemniskate involves the SqRt of negative
numbers, which is not allowed in LC, I am stumped.

You can find Bernd’s animation here:
https://forums.livecode.com/viewtopic.php?f=10=36412



In general lemniscates are defined as the roots of a specific kind of 
quartic (power four) polynomials of the pattern:


    (x^2 + y^2)^2 - cx^2 - dy^2 = 0

So the algorithms for solving them you are probably finding are more 
general 'quartic polynomial' solvers - just like solving quadratic 
equations, the full set of solutions can only be computed if you flip 
into the complex plane (i.e. where sqrt(-1) exists) rather than the 
real plane.


However, there is at least one type of Lemniscate for which there is a 
nice parametric form - Bernoulli's lemniscate, which is a slightly 
simpler equation:


    (x^2 + y^2)^2 - 2a^2(x^2 - y^2) = 0

According to https://mathworld.wolfram.com/Lemniscate.html, this can 
be parameterized as:


    x = (a * cos(t)) / (1 + sin(t)^2)

    y = (a * sin(t) * cos(t)) / (1 + sin(t)^2)

Its not clear what the range of t is from the article, but I suspect 
it will be -pi <= t <= pi (or any 2*pi length range).


So a simple repeat loop where N is the number of steps you want to 
take, and A is the 'scale' of the lemniscate should give you the 
points you want:


    repeat with t = -pi to pi step (2*pi / N)
   put A * cos(t) / (1 + sin(t)^2) into X
   put A * sin(t) * cos(t) / (1 + sin(t)^2) into Y
   put X, Y & return after POINTS
    end repeat

Warmest Regards,

Mark.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-03 Thread Mark Waddingham via use-livecode

Hi Roger,

On 2021-11-02 22:27, Roger Guay via use-livecode wrote:

Dear List,

Bernd has produced an absolutely beautiful animation using a
Lemniskate polygon that was previously provided by Hermann Hoch. Can
anyone provide some help on how to create this polygon mathematically?
Since the equation for a Lemniskate involves the SqRt of negative
numbers, which is not allowed in LC, I am stumped.

You can find Bernd’s animation here:
https://forums.livecode.com/viewtopic.php?f=10=36412



In general lemniscates are defined as the roots of a specific kind of 
quartic (power four) polynomials of the pattern:


(x^2 + y^2)^2 - cx^2 - dy^2 = 0

So the algorithms for solving them you are probably finding are more 
general 'quartic polynomial' solvers - just like solving quadratic 
equations, the full set of solutions can only be computed if you flip 
into the complex plane (i.e. where sqrt(-1) exists) rather than the real 
plane.


However, there is at least one type of Lemniscate for which there is a 
nice parametric form - Bernoulli's lemniscate, which is a slightly 
simpler equation:


(x^2 + y^2)^2 - 2a^2(x^2 - y^2) = 0

According to https://mathworld.wolfram.com/Lemniscate.html, this can be 
parameterized as:


x = (a * cos(t)) / (1 + sin(t)^2)

y = (a * sin(t) * cos(t)) / (1 + sin(t)^2)

Its not clear what the range of t is from the article, but I suspect it 
will be -pi <= t <= pi (or any 2*pi length range).


So a simple repeat loop where N is the number of steps you want to take, 
and A is the 'scale' of the lemniscate should give you the points you 
want:


repeat with t = -pi to pi step (2*pi / N)
   put A * cos(t) / (1 + sin(t)^2) into X
   put A * sin(t) * cos(t) / (1 + sin(t)^2) into Y
   put X, Y & return after POINTS
end repeat

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-02 Thread Roger Guay via use-livecode
Yes, I suppose so. Even easier would be to modify the points of a polygon 
generated from R = 10*sin(theta)*cos(theta) in polar coordinates (a four leaf 
clover type), but I’m hoping to avoid that.
Thanks,
Roger

> On Nov 2, 2021, at 3:43 PM, Paul Dupuis via use-livecode 
>  wrote:
> 
> For the infinity symbol polygon, wouldn't a possible way to do this is by 
> modeling a tear drop (see http://paulbourke.net/geometry/teardrop/ which does 
> not require imaginary numbers) and duplicating the points with opposite signs 
> for the other half?
> 
> On 11/2/2021 6:27 PM, Roger Guay via use-livecode wrote:
>> Dear List,
>> 
>> Bernd has produced an absolutely beautiful animation using a Lemniskate 
>> polygon that was previously provided by Hermann Hoch. Can anyone provide 
>> some help on how to create this polygon mathematically? Since the equation 
>> for a Lemniskate involves the SqRt of negative numbers, which is not allowed 
>> in LC, I am stumped.
>> 
>> You can find Bernd’s animation here: 
>> https://forums.livecode.com/viewtopic.php?f=10=36412 
>> 
>> 
>> Thanks,
>> Roger
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Lemniscate Polygon

2021-11-02 Thread Paul Dupuis via use-livecode
For the infinity symbol polygon, wouldn't a possible way to do this is 
by modeling a tear drop (see http://paulbourke.net/geometry/teardrop/ 
which does not require imaginary numbers) and duplicating the points 
with opposite signs for the other half?


On 11/2/2021 6:27 PM, Roger Guay via use-livecode wrote:

Dear List,

Bernd has produced an absolutely beautiful animation using a Lemniskate polygon 
that was previously provided by Hermann Hoch. Can anyone provide some help on 
how to create this polygon mathematically? Since the equation for a Lemniskate 
involves the SqRt of negative numbers, which is not allowed in LC, I am stumped.

You can find Bernd’s animation here: 
https://forums.livecode.com/viewtopic.php?f=10=36412 


Thanks,
Roger
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode