Forgotten Password?

Or login with:

• http://facebook.com/
• https://www.google.com/accounts/o8/id
• https://me.yahoo.com
COST (GBP)
0.97
0.00
0

# first order

Solves the linear inhomogeneous recurrence relation
Controller: john

C++

## First Order

 doublefirst_order( double u0 double a double b int n )
The solution to an inhomogenous recurrence relationship of the form
$u_{n+1}&space;=&space;a&space;u_n&space;+&space;b$
where $\inline&space;u_0$ is constant is
$u_n&space;=&space;\left&space;(&space;u_0&space;+&space;\frac{b}{a-1}&space;\right&space;)&space;a^n&space;-&space;\frac{b}{a-1}$

Purchase a Licence for more information.

### Example 1

The annual birth rate of a small island is 1.1 per capita. There is also a constant influx of 10 new imigrants to the island each year. If the initial population is 580, what is the population after each year for the next 10 years
#include <stdio.h>
#include <codecogs/maths/discrete/recurrence/linear/inhomogeneous/first_order.h>

using namespace Maths::Recurrence::Linear::InHomogeneous;
int main()
{
double intial_pop=580;  // an initial population
double birth_rate=1.1;   // average birthrate per capita
double imigration=10;   // direct imigration
for(int i=0;i<=10;i++)
printf("\n Year=%d  Population=%lf",i, first_order(intial_pop, birth_rate, imigration, i));
return 0;
}

### Output

Year=0  Population=580.000000
Year=1  Population=648.000000
Year=2  Population=722.800000
Year=3  Population=805.080000
Year=4  Population=895.588000
Year=5  Population=995.146800
Year=6  Population=1104.661480
Year=7  Population=1225.127628
Year=8  Population=1357.640391
Year=9  Population=1503.404430
Year=10  Population=1663.744873

### Parameters

 u0 The first (initial) term of the series. a Homogeous factor - multiplier for each additional term of the recurrence series. b Inhomegeneous factor - additional constant added at each step of the recurrence. n The number of terms from the recursive series to evaluate.
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Last Modified: 28 Dec 11 @ 00:31     Page Rendered: 2022-03-14 17:36:57