Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
I have an integer sequence of a fractal nature and want to know if it is 
possible to write a program to illustrate it in a manner similar to the many 
animated Mandelbrot illustrations.

The sequence is defined by:

For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = a(n) + 
a(n-2).

Output begins:
1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 28, 
27, 26, 24, 27, 31, 33...

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
>> The sequence is defined by:
>>
>> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = a(n) 
>> + a(n-2).
>>
>   Confusing explanation -- do you really mean that for n>=4 you are
> returning TWO values? If so, it is not a strict function. I'd also write it
> as

I think they intend that a(n) is defined for n being an integer (or
maybe just the Natural Numbers, since it isn't defined for values below 1)

The two provided definitions provide the recursive definition for even
and odd values.

I am not sure what 'fractal' property this sequence has that he wants to
display.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
> >> The sequence is defined by:
> >>
> >> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = 
> >> a(n) + a(n-2).
> >>
> > Confusing explanation -- do you really mean that for n>=4 you are
> > returning TWO values? 

For a(4)..a(19) we have that: 2+3=5, 1+3=4, 3+5=8, 2+5=7, 5+4=9, 3+4=7, 4+8=12, 
5+8=13, 8+7=15, 4+7=11, 7+9=16, 8+9=17, 9+7=16, 7+7=14, 7+12=19, 9+12=21.

If so, it is not a strict function. I'd also write it
> > as
> 
> I think they intend that a(n) is defined for n being an integer (or
> maybe just the Natural Numbers, since it isn't defined for values below 1)
> 
> The two provided definitions provide the recursive definition for even
> and odd values.
> 
> I am not sure what 'fractal' property this sequence has that he wants to
> display.

I'm sorry, let me try to explain:

Here is my output:
1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 28, 
27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 41, 48, 
53, 55, 47, 53, 54, 50, 51, 51, 53,

It is an OEIS sequence. 

I was told this image of the scatterplot emphasizes the 'fractal nature' of my 
sequence:

https://oeis.org/A292575/a292575.png
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Oscar Benjamin
On Sat, 25 Aug 2018 at 20:27, Musatov  wrote:
>
> On Saturday, August 25, 2018 at 2:18:09 PM UTC-5, Musatov wrote:
> > On Saturday, August 25, 2018 at 1:52:17 PM UTC-5, Oscar Benjamin wrote:
> > > > > >
> > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > >>
> > > > > >>> I am looking for a program able to output a set of integers 
> > > > > >>> meeting the
> > > > > >>> following requirement:
> > > > > >>>
> > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 if 
> > > > > >>> no such
> > > > > >>> k exists
> > > > > >>>
> > > > > >>> Could anyone get me started? (I am an amateur)
> > > > > >>
> > > > > >> That's more a maths question than a programming question. Find out 
> > > > > >> how to
> > > > > >> tackle it mathematically, and then we can code it.
> > >
> > > Looks like it's zero for any multiple of 3 (apart from 3 itself). This
> > > makes sense since if n is a equal to b*3 for some integer b then
> > > n*2^k - 3 = b*3*2^k - 3 = (b*2^k - 1)*3
> > > which can only be prime if
> > > b*2^k - 1 = 1
> > > which can only be true if b=1 (since k>0) implying that n=3. So for
> > > any *other* multiple of 3 you must necessarily have a(n) = 0.
> > >
> > > The above means that you can handle all multiples of 3 but how do you
> > > know that you won't hit an infinite loop when n is not a multiple of
> > > 3?
>
> Rather, I should say one such n is 
> 72726958979572419805016319140106929109473069209 (which is not divisible by 3)

Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
loop through testing k=1,2...) but the issue is determining for any
given n whether a(n)=0 i.e. that there does not exist k such that
n*2^k-3 is prime.

Perhaps if you explain how you know that
   a(72726958979572419805016319140106929109473069209) = 0
then that would suggest a way to code it.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> On Sat, 25 Aug 2018 at 20:27, Musatov  wrote:
> >
> > On Saturday, August 25, 2018 at 2:18:09 PM UTC-5, Musatov wrote:
> > > On Saturday, August 25, 2018 at 1:52:17 PM UTC-5, Oscar Benjamin wrote:
> > > > > > >
> > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > >>
> > > > > > >>> I am looking for a program able to output a set of integers 
> > > > > > >>> meeting the
> > > > > > >>> following requirement:
> > > > > > >>>
> > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 if 
> > > > > > >>> no such
> > > > > > >>> k exists
> > > > > > >>>
> > > > > > >>> Could anyone get me started? (I am an amateur)
> > > > > > >>
> > > > > > >> That's more a maths question than a programming question. Find 
> > > > > > >> out how to
> > > > > > >> tackle it mathematically, and then we can code it.
> > > >
> > > > Looks like it's zero for any multiple of 3 (apart from 3 itself). This
> > > > makes sense since if n is a equal to b*3 for some integer b then
> > > > n*2^k - 3 = b*3*2^k - 3 = (b*2^k - 1)*3
> > > > which can only be prime if
> > > > b*2^k - 1 = 1
> > > > which can only be true if b=1 (since k>0) implying that n=3. So for
> > > > any *other* multiple of 3 you must necessarily have a(n) = 0.
> > > >
> > > > The above means that you can handle all multiples of 3 but how do you
> > > > know that you won't hit an infinite loop when n is not a multiple of
> > > > 3?
> >
> > Rather, I should say one such n is 
> > 72726958979572419805016319140106929109473069209 (which is not divisible by 
> > 3)
> 
> Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> loop through testing k=1,2...) but the issue is determining for any
> given n whether a(n)=0 i.e. that there does not exist k such that
> n*2^k-3 is prime.
> 
> Perhaps if you explain how you know that
>a(72726958979572419805016319140106929109473069209) = 0
> then that would suggest a way to code it.
> 
> --
> Oscar
Oscar, I simply asked someone and they provided me the number. I know they 
often use Maple, but I was interested in Python.

He also said some of the n are prime by Dirichlet's theorem. One is 
8236368172492875810638652252525796530412199592269.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 1:58 PM, Musatov wrote:
> On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
>> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
 The sequence is defined by:

 For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = 
 a(n) + a(n-2).

>>> I am not sure what 'fractal' property this sequence has that he
>>> wants to 
>> display.
> I'm sorry, let me try to explain:
>
> Here is my output:
> 1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 
> 28, 27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 
> 41, 48, 53, 55, 47, 53, 54, 50, 51, 51, 53,
>
> It is an OEIS sequence. 
>
> I was told this image of the scatterplot emphasizes the 'fractal nature' of 
> my sequence:
>
> https://oeis.org/A292575/a292575.png

Something is wrong with that image compared to the sequence, as the
sequence is always positive, and in fact the lowest the sequence can get
to is always increasing (as it starts always positive, and each term is
the sum of two previous terms),while the graph is going negative.

(actually going to the definition of the sequence, the plot isn't of
a(n) but a(n)-n, which can go negative)

I normally think for fractals as a sequence of patterns of increasing
complexity, or a pattern looked at with increasing resolution revealing
the growth pattern. This sequence isn't quite like that, but I suppose
if you think of the sequence a(n) in the interval m <= n <= 2*m, and
then the interval 2*m <= n <= 4*m, that second interval is somewhat like
the first with some recursively added pattern (especially if you include
the -n in the sequence).

That graph is probably the best way to show that pattern.

One thing that might help, is to clean up the definition of a(n) to be
more directly computable, and  maybe even include the subtraction of n.

A rewriting of your rules would be:

a(n)

n=1,2,3:    a(n) = n

n>3, and even: a(n) = a(n/2) + a(n/2+1)

n>3 and odd: a(n) = a((n+1)/2) + a(n-3)/2)

If I have done my math right, this is the same sequence definition, but
always defining what a(n) is equal to.

If we want to define the sequence b(n) = a(n) - n, we can transform the
above by substitution

b(n)

n=1,2,3: b(n) = 0

n>3 and even: b(n) = a(n/2)+a(n/2+1)-n

    = b(n/2)+b(n/2+1) + n/2 + n/2+1 -n

    = b(n/2) + b(n/2+1) + 1

n>3 and odd: b(n) = a((n+1)/2) + a((n-3)/2) - n

    = b((n+1)/2) + b((n-3)/2) + (n+1)/2 + (n-3)/2 -n

    = b((n+1)/2) + b((n-3)/2) -1

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 2:35:13 PM UTC-5, Richard Damon wrote:
> On 8/26/18 1:58 PM, Musatov wrote:
> > On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
> >> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
>  The sequence is defined by:
> 
>  For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = 
>  a(n) + a(n-2).
> 
> >>> I am not sure what 'fractal' property this sequence has that he
> >>> wants to 
> >> display.
> > I'm sorry, let me try to explain:
> >
> > Here is my output:
> > 1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 
> > 28, 27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 
> > 41, 48, 53, 55, 47, 53, 54, 50, 51, 51, 53,
> >
> > It is an OEIS sequence. 
> >
> > I was told this image of the scatterplot emphasizes the 'fractal nature' of 
> > my sequence:
> >
> > https://oeis.org/A292575/a292575.png
> 
> Something is wrong with that image compared to the sequence, as the
> sequence is always positive, and in fact the lowest the sequence can get
> to is always increasing (as it starts always positive, and each term is
> the sum of two previous terms),while the graph is going negative.
> 
> (actually going to the definition of the sequence, the plot isn't of
> a(n) but a(n)-n, which can go negative)
> 
> I normally think for fractals as a sequence of patterns of increasing
> complexity, or a pattern looked at with increasing resolution revealing
> the growth pattern. This sequence isn't quite like that, but I suppose
> if you think of the sequence a(n) in the interval m <= n <= 2*m, and
> then the interval 2*m <= n <= 4*m, that second interval is somewhat like
> the first with some recursively added pattern (especially if you include
> the -n in the sequence).
> 
> That graph is probably the best way to show that pattern.
> 
> One thing that might help, is to clean up the definition of a(n) to be
> more directly computable, and  maybe even include the subtraction of n.
> 
> A rewriting of your rules would be:
> 
> a(n)
> 
> n=1,2,3:    a(n) = n
> 
> n>3, and even: a(n) = a(n/2) + a(n/2+1)
> 
> n>3 and odd: a(n) = a((n+1)/2) + a(n-3)/2)
> 
> If I have done my math right, this is the same sequence definition, but
> always defining what a(n) is equal to.
> 
> If we want to define the sequence b(n) = a(n) - n, we can transform the
> above by substitution
> 
> b(n)
> 
> n=1,2,3: b(n) = 0
> 
> n>3 and even: b(n) = a(n/2)+a(n/2+1)-n
> 
>     = b(n/2)+b(n/2+1) + n/2 + n/2+1 -n
> 
>     = b(n/2) + b(n/2+1) + 1
> 
> n>3 and odd: b(n) = a((n+1)/2) + a((n-3)/2) - n
> 
>     = b((n+1)/2) + b((n-3)/2) + (n+1)/2 + (n-3)/2 -n
> 
>     = b((n+1)/2) + b((n-3)/2) -1
> 
> -- 
> Richard Damon

Thank you, Richard. If anyone is interested further, even in writing a Python 
code to generate the sequence or further preparing of an animation I would be 
delighted.

Musatov
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Oscar Benjamin
On Sun, 26 Aug 2018 at 20:32, Musatov  wrote:
>
> On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > > >>
> > > > > > > >>> I am looking for a program able to output a set of integers 
> > > > > > > >>> meeting the
> > > > > > > >>> following requirement:
> > > > > > > >>>
> > > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 
> > > > > > > >>> if no such
> > > > > > > >>> k exists
> > > > > > > >>>
> > > > > > > >>> Could anyone get me started? (I am an amateur)
> >
> > Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> > loop through testing k=1,2...) but the issue is determining for any
> > given n whether a(n)=0 i.e. that there does not exist k such that
> > n*2^k-3 is prime.
> >
> > Perhaps if you explain how you know that
> >a(72726958979572419805016319140106929109473069209) = 0
> > then that would suggest a way to code it.
> >
> Oscar, I simply asked someone and they provided me the number. I know they 
> often use Maple, but I was interested in Python.
> He also said some of the n are prime by Dirichlet's theorem. One is 
> 8236368172492875810638652252525796530412199592269.

If it is possible at all then it is certainly possible to do this in
Python but only for someone who knows the necessary maths. The purpose
of computers in these kinds of problems is that they are much faster
at number-crunching. You still need to know how (at least in
principle) you would do this by hand in order to program it in Python
or most likely anything else.

I don't think anyone here knows the answer to the mathematical
question "how do I prove that a(n)=0 for some n?". If you knew the
answer to that question then I'm sure many people could help you write
code for it.

Without that I think you need to go back to your mathematician friends
or do some more reading.

Are you sure that the problem you have posed here is solvable (i.e.
that whether or not a(n)=0 is decidable for any n)?

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Oscar Benjamin
On Sun, 26 Aug 2018 at 20:52, Musatov  wrote:
>
> Thank you, Richard. If anyone is interested further, even in writing a Python 
> code to generate the sequence or further preparing of an animation I would be 
> delighted.

It would not take long to write code to plot your sequence if you
first cover the basics of Python. What have you tried so far?

Have you read the python.org tutorial? Here's a page from there that
mentions the Fibonacci sequence incidentally:
https://docs.python.org/3/tutorial/modules.html

For plotting I suggest matplotlib:
https://matplotlib.org/users/pyplot_tutorial.html

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 3:07:41 PM UTC-5, Oscar Benjamin wrote:
> On Sun, 26 Aug 2018 at 20:32, Musatov  wrote:
> >
> > On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> > > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > > > >>
> > > > > > > > >>> I am looking for a program able to output a set of integers 
> > > > > > > > >>> meeting the
> > > > > > > > >>> following requirement:
> > > > > > > > >>>
> > > > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 
> > > > > > > > >>> 0 if no such
> > > > > > > > >>> k exists
> > > > > > > > >>>
> > > > > > > > >>> Could anyone get me started? (I am an amateur)
> > >
> > > Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> > > loop through testing k=1,2...) but the issue is determining for any
> > > given n whether a(n)=0 i.e. that there does not exist k such that
> > > n*2^k-3 is prime.
> > >
> > > Perhaps if you explain how you know that
> > >a(72726958979572419805016319140106929109473069209) = 0
> > > then that would suggest a way to code it.
> > >
> > Oscar, I simply asked someone and they provided me the number. I know they 
> > often use Maple, but I was interested in Python.
> > He also said some of the n are prime by Dirichlet's theorem. One is 
> > 8236368172492875810638652252525796530412199592269.
> 
> If it is possible at all then it is certainly possible to do this in
> Python but only for someone who knows the necessary maths. The purpose
> of computers in these kinds of problems is that they are much faster
> at number-crunching. You still need to know how (at least in
> principle) you would do this by hand in order to program it in Python
> or most likely anything else.
> 
> I don't think anyone here knows the answer to the mathematical
> question "how do I prove that a(n)=0 for some n?". If you knew the
> answer to that question then I'm sure many people could help you write
> code for it.
> 
> Without that I think you need to go back to your mathematician friends
> or do some more reading.
> 
> Are you sure that the problem you have posed here is solvable (i.e.
> that whether or not a(n)=0 is decidable for any n)?
> 
> --
> Oscar

My understanding is this: there are an infinite number of n's that are not 
multiples of three, and yet will always be divisible by at least one of 22 
primes for all values of k.

i.e. certain n values make the equation produce only composite numbers for all 
values of k.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 3:13:00 PM UTC-5, Oscar Benjamin wrote:
> On Sun, 26 Aug 2018 at 20:52, Musatov  wrote:
> >
> > Thank you, Richard. If anyone is interested further, even in writing a 
> > Python code to generate the sequence or further preparing of an animation I 
> > would be delighted.
> 
> It would not take long to write code to plot your sequence if you
> first cover the basics of Python. What have you tried so far?
> 
> Have you read the python.org tutorial? Here's a page from there that
> mentions the Fibonacci sequence incidentally:
> https://docs.python.org/3/tutorial/modules.html
> 
> For plotting I suggest matplotlib:
> https://matplotlib.org/users/pyplot_tutorial.html
> 
> --
> Oscar

I have some learning to do, but if I get stuck I'll write back on this thread.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 3:21:08 PM UTC-5, Musatov wrote:
> On Sunday, August 26, 2018 at 3:07:41 PM UTC-5, Oscar Benjamin wrote:
> > On Sun, 26 Aug 2018 at 20:32, Musatov  wrote:
> > >
> > > On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> > > > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > > > > >>
> > > > > > > > > >>> I am looking for a program able to output a set of 
> > > > > > > > > >>> integers meeting the
> > > > > > > > > >>> following requirement:
> > > > > > > > > >>>
> > > > > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, 
> > > > > > > > > >>> or 0 if no such
> > > > > > > > > >>> k exists
> > > > > > > > > >>>
> > > > > > > > > >>> Could anyone get me started? (I am an amateur)
> > > >
> > > > Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> > > > loop through testing k=1,2...) but the issue is determining for any
> > > > given n whether a(n)=0 i.e. that there does not exist k such that
> > > > n*2^k-3 is prime.
> > > >
> > > > Perhaps if you explain how you know that
> > > >a(72726958979572419805016319140106929109473069209) = 0
> > > > then that would suggest a way to code it.
> > > >
> > > Oscar, I simply asked someone and they provided me the number. I know 
> > > they often use Maple, but I was interested in Python.
> > > He also said some of the n are prime by Dirichlet's theorem. One is 
> > > 8236368172492875810638652252525796530412199592269.
> > 
> > If it is possible at all then it is certainly possible to do this in
> > Python but only for someone who knows the necessary maths. The purpose
> > of computers in these kinds of problems is that they are much faster
> > at number-crunching. You still need to know how (at least in
> > principle) you would do this by hand in order to program it in Python
> > or most likely anything else.
> > 
> > I don't think anyone here knows the answer to the mathematical
> > question "how do I prove that a(n)=0 for some n?". If you knew the
> > answer to that question then I'm sure many people could help you write
> > code for it.
> > 
> > Without that I think you need to go back to your mathematician friends
> > or do some more reading.
> > 
> > Are you sure that the problem you have posed here is solvable (i.e.
> > that whether or not a(n)=0 is decidable for any n)?
> > 
> > --
> > Oscar
> 
> My understanding is this: there are an infinite number of n's that are not 
> multiples of three, and yet will always be divisible by at least one of 22 
> primes for all values of k.
> 
> i.e. certain n values make the equation produce only composite numbers for 
> all values of k.

Just to be clear it is not the n I was referring to being composite but the 
result when certain n are fed into the n*2^k - 3
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Richard Damon
On 8/26/18 4:20 PM, Musatov wrote:
> My understanding is this: there are an infinite number of n's that are not 
> multiples of three, and yet will always be divisible by at least one of 22 
> primes for all values of k.
>
> i.e. certain n values make the equation produce only composite numbers for 
> all values of k.

But that isn't enough to make the function computable. While we may be
able to have some short cut rules to tell us that for SOME n, the answer
is 0, unless we can answer that question for ALL n, we can't be sure to
compute the answer. If we could compute an upper limit for k given n,
then we could do the computation, but we need to have some rule to stop,
or there may be some values of n that we will loop forever on.

As has been said, this problem is still in the domain of needing some
math to give us the rule to compute with.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 5:40 PM, Dennis Lee Bieber wrote:
>   But their definition is still confusing as it is formulated with a
> expression as the argument to a().
>
>   Taken literally, it says for n+4 to call a() with an argument of 8 (2n)
> AND to call it with an argument of 7 (2n-1) (returning two values) 

I have seen that sort of notation before for defining sequences (which
is what he was doing). Yes, it is not very useful for actually
implementing a function to compute the values, but if a was stored in an
array it makes some sense, as you make a loop that runs n, and compute
the various elements. The one confusion with how it was defined was that
the recursive definition starts at n=2, but for that value you only
compute the even value, as 2*n-1 = 3 which has already been defined, and
that definition would reference a(0) which hasn't been defined.

This is one reason I presented what I say as the 'normalized' equations
which are what would be more needed to actually compute as a function.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list