Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1994
*January
*February
*March
*April
*May
*June
*July
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Nonlinear Discrete

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Nonlinear Discrete
  • From: scherm at ifm.uni-hannover.de
  • Date: Fri, 25 Feb 1994 15:19:20 +0000

Responding to :
>Dear Users
>	I am currently engaged in writing a function to deal with
>some discrete nonlinear system, but unfortunately I am a completely novice
>as Mathematica programmer.  Can someone out there give some clue how
>to implement a problem such as the following one, please?
>	y(t)=a*y(t-1)+b*y(t-2)+c*y(t-1)*y(t-1) ->  First how to code?
                                                   ~~~~~~~~~~~~~~~~~~

Please type the following lines: 
First you specify the difference equation like

y[k_]:=0.5*y[k-1]+1*y[k-2]+y[k-1]*y[k-1];

Then you determine the series y(k) with two initial values

y[0]=1;
y[1]=1;

All you have to do now is to 'enjoy' the results:

Print[y[2],"  ",y[3],"  ",y[4],"  ",y[9]];

gives
                         60
2.5  8.5  79.  5.99223 10

This method is quite simple but
be aware that you defined a recursive difference equation. The MATHEMATICA
Kernel will need a long time to calculate for example y(9).
If you are interested in getting the complete sequence 
y(0)..y(9) it will be better to use the following 

y[0]=1;
y[1]=1;

For[i=2,i<=9,i++,
y[i]=0.5*y[i-1]+1*y[i-2]+y[i-1]*y[i-1];
Print[y[i]];
]; 

It will run much faster and gives:
2.5
8.5
79.
6289.
          7
3.95547 10
          15
1.56458 10
         30
2.4479 10
          60
5.99223 10

I hope this was helpful..

(Norbert Scherm) 


>
>
>






  • Prev by Date: Mistroke
  • Next by Date: Solve--Solutions
  • Previous by thread: Nonlinear Discrete
  • Next by thread: Re: Teaching Complex Analysis