I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.97
sub units 0.00
+
2

first order

Solves the linear inhomogeneous recurrence relation
Controller: john

Interface

C++

First Order

 
doublefirst_orderdoubleu0
doublea
doubleb
intn )
The solution to an inhomogenous recurrence relationship of the form where \inline u_0 is constant is

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

u0The first (initial) term of the series.
aHomogeous factor - multiplier for each additional term of the recurrence series.
bInhomegeneous factor - additional constant added at each step of the recurrence.
nThe 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.