a n + 1 = 2 a n − n 2 + n
Define a sequence a n that satisfy the recurrence relation as described above, with a 1 = 3 . Find the value of 1 8 1 3 3 ∣ a 2 0 − a 1 5 ∣ .
Bonus : Generalize this for all values of a n .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I solved the same way :)
Log in to reply
Congratulations. You are smart, indeed :D
Log in to reply
What's the source of the problem. If you love recurrences then you should try this
Log in to reply
@Ronak Agarwal – I too don't remember my sources. I solve many subjective Olympiad level problems usually. I just twist these problems to make it an Integer-Type !
Some mistakes but at third attempt i did it !
I there any systematic method to solve recurrence relations of the type f ( a n , a n − 1 , ⋯ , a 0 ) = p ( n ) where f and p are polynomial functions?
First, evaluate a 0 : a 1 = 2 a 0 ⇒ a 0 = 2 3
Then, use Z-transform: a n + 1 − 2 a n + n 2 − n = 0
z ( A ( z ) − a 0 ) − 2 A ( z ) + ( z − 1 ) 3 z ( z + 1 ) − ( z − 1 ) 2 z = 0
⇒ A ( z ) = 2 ( z − 2 ) ( z − 1 ) 3 z ( 3 z 3 − 9 z 2 + 9 z − 7 )
⇒ A ( z ) = 2 ( z − 2 ) ( z − 1 ) 3 z ( 3 z 3 − 9 z 2 + 9 z − 7 )
⇒ A ( z ) = z − 1 2 z + ( z − 1 ) 2 z + ( z − 1 ) 3 z ( z + 1 ) − 2 ( z − 2 ) z
Working in the inverse of the Z-transform: a n = 2 + n + n 2 − 2 n − 1
Now: a 2 0 = 4 2 2 − 2 1 9 ; a 1 5 = 2 4 2 − 2 1 4 ;
1 8 1 3 3 ∣ a 2 0 − a 1 5 ∣ = 1 8 1 3 3 2 1 9 − 2 1 4 + 1 8 0 = 2 8
I came to learn about z-transform after this solution :)
Log in to reply
So I think it worthed posting it.
Z-transform is a great tool for solving difference equations.
Log in to reply
Can you solve this problem : Recurring Styles #2 using Z-transform?
Log in to reply
@Satyajit Mohanty – After doing b n = ln ( a n ) , of course.
Solved.
Log in to reply
@Juan Vidal Flores Apaza – Can you post your solution there. People will learn a new solution to that problem :)
Brute force
Slightly more subtlety
We see that the 3rd and higher differences assume the pattern characteristic of an exponential function. Hence, this is part of the required solution (but not all of it). Accordingly, I remove a convenient exponential component from the terms and recalculate.
And this reveals the remaining quadratic component. We can therefore model the required solution as,
r 2 n + s n 2 + t n + u = a n
substitute values for n and a n and solve for the required constants.
r=-1/2, s=1, t=1, u=2
This is correct now.
I cannot independently verify your solution, as I have a little knowledge of programming. @Pranjal Jain , will you help me get this solution verified?
Log in to reply
Apologies, I suppose I must have copied the coefficients from the wrong place.
By the way, I can atleast say that your final expression for a n seems incorrect. Please re-check it.
Why use generator when you can use a list?
Log in to reply
Lists use space for each entry and are inherently finite. A generator can produce a finite number of results or (potentially) an infinite number. They can also be made more easily read, and might be capable of more for a given level of complexity.
Log in to reply
I just created the list while len(list_name)<21. Anyway, thanks for introducing generators. I knew about them but I tend not to use them. ⌣ ¨
Log in to reply
@Pranjal Jain – In the end, it's possible that I just like them. ;)
You mean n 2 + 3 n + 4 − 2 n ? In that case, a 1 = 3
Python
values = {1:3}
def a(n):
if n not in values:
m = n-1
x = 2 * a(m)
x -= m**2
x += m
values[n] = x
return values[n]
else:
return values[n]
print abs(a(20)-a(15))/18133.0
long int series(int n)
{
if (n==1){return 3;}else{
long int t=series(n-1);
long int f=2*series(n-1)-((n-1)*(n-1))+(n-1);
return f;
}
}
int main()
{
int i;
scanf("%d",&i);
long int f;f=series(i+5);
long int k;k=series(i);
double p=0;p=(double)f-(double)k;
if(p>0){printf("%f",p/18133);}else
{printf("%f",-p/18133);}
return 0;
}
NOTE : C language
Problem Loading...
Note Loading...
Set Loading...