FUNCTION
first_order
Solves the linear inhomogeneous recurrence relation
You're viewing an older version of this page (#593). View the current version.
Interface
#include <codecogs/maths/discrete/recurrence/linear/inhomogeneous/first_order.h>
using namespace Maths::Discrete::Recurrence::Linear::Inhomogeneous;
The solution to an inhomogenous recurrence relationship of the form
(1)
where is constant is
(2)
This part is only visible to registered users. Sign in to see it.
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.744873Parameters
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.
Interactive Calculator
u0
a
b
n
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.