Items tagged with recursive recursive Tagged Items Feed

I'm trying to plot the graph of a recursive function in Maple 17 but I keep getting the error Error, (in f) too many levels of recursion.

I need to plot a logarithmic graph in the range of x=1,...40. Here is the code:

with(plots); 
f:=x->(2.25*f(x-1)-0.5*f(x-2));
f(1):=1/3;
f(2):=1/12;
logplot(f(x),1..40);

How can I fix this problem? Maybe I need to write it in an iterative form, but I don't know how. Thank you very much for any help!

Hi:

how obtain value a4 from below equation in maple:

a[0]=1

a[n+2]=a[0]+a[n+1]

I can get the function to iterate as a recursive function by just reevaluating the x := evalf(x-(f1*j-i*g1)/(h*k-i*j), 25); y := evalf(y-(h*g1-f1*j)/(h*k-i*j), 25) portion of the function below but im trying beneath it to assign it as newt2d so that i can iterate it as newtons method in two variables like (newt2d@@10) and I can't seem to figure out what im doing wrong. Thanks for any help you can provide!

f := proc (x, y) options operator, arrow; x+y-cos(x)+sin(y-1) end proc; f1 := f(x, y)

(x, y) -> x + y - cos(x) + sin(y - 1)
x + y - cos(x) + sin(y - 1)

> g := proc (x, y) options operator, arrow; x^4+y^4-2*x*y end proc; g1 := g(x, y);

(x, y) -> x + y - 2 x y
x + y - 2 x y

> dh := D[1](f); h := dh(x, y);

(x, y) -> 1 + sin(x)
1 + sin(x)

> di := D[2](f); i := di(x, y);

(x, y) -> 1 + cos(y - 1)
1 + cos(y - 1)

> dj := D[1](g); j := dj(x, y);

(x, y) -> 4 x - 2 y
4 x - 2 y

> dk := D[2](g); k := dk(x, y);

(x, y) -> 4 y - 2 x
4 y - 2 x

x := .3; y := .8

0.3
0.8

> x := evalf(x-(f1*j-i*g1)/(h*k-i*j), 25); y := evalf(y-(h*g1-f1*j)/(h*k-i*j), 25);

0.2924403963319692595180140
0.8321243516906678979858730

> newt2d(.3, .8);

0.2577789764, 0.8333916830

> (newt2d@@5)(.3, .8);

Error, (in @@) invalid arguments



For the recursive equation

xn − 10xn−1 + 50xn−2 = 0
n = 2, 3, ...
x0 = 0
x1 = 10

How do I calculate xn in Maple? I'm wondering because n doesn't start at 0 but at 2, how will that make a difference?

Thanks in advance!

I want to use maple to solve the following recursive inhomogenous equation:

Xn+2 - 5xn+1 6xn = 4n+1

I thought I could write like this:

 

 but it doesn't work. I get the error message

"Error, (in rsolve/single) equation false = 0 does not involve function F()"

How should I write in order to solve it?

Hello !

I installed Maple 14 on my windows8 computer (with compatibility windows7). My program worked the 2 first times, and suddently it bugged on the third, though I changed NOTHING.

It puts me an "Error: recursive assignment". The concerned line is: 

if a < 2 then broSet := broSet union {[param[1, j], param[2, i]]} fi:

There should be no problem.

Does anyone have any idea ?

 

Hi

Long story short I had a detailed question and then the session timed out and killed it!

Quickly then, if we calculate something recursively Maple acts differently to other languages.

For example, in Python:

__________________________________________

>>>t=1;

>>>t+=1;

>>>print t;

___________________________________________

Is interpreted as:

__________________________________________

>>>t=1;

>>>t=t+1=2

>>>print t

2

___________________________________________

In Maple:

___________________________________________

>t:=1

>t:=t+1

>print(t)

___________________________________________

Is Interpreted as:

___________________________________________

>t=1

>t=t+1=1+1=2

>print(t); t=t+1=1+1=2

2

____________________________________________
And there in lies my problem. Logically, I wish to use a iterative algorithm to work out an expression of the nth derivative of a function from the (n-1) derivative. However, doing this is in maple brings up "error (in Test) too many levels of recursion".

 

For context, Minimum Working Example:

____________________________________________

>TestFunction:=(x)->cos(exp(-1/x^2))*F(x):

>limit(TestFunction(x),x=0)

F(0)

>TestDerivative:=(x)->eval(diff(TestFunction(y),y),y=x):

>limit(TestDerivative(x),x=0)

D(F)(0)

>for i from 1 to 50 do
print(D^(i)(TestFunction)(0)=limit(TestDerivative(x),x=0));

TestDerivative:=(x)->eval(diff(TestDerivative(y),y),y=x):

od:

D(TestFunction)(0)=D(F)(0)

Error, (in TestDerivative) too many levels of recursion

_______________________________________________

Ideally, this code would output the limit of the second derivative at zero by differentiating the first derivative and then the limit of the third derivative at zero by differentiating the second derivative etc. But what Maple is trying to do is to find the limit of the second derivative by differentiating the function then differentiating the result of that, then to find the limit of the third derivative it will first derivative by differentiate the function, then the second by differentiating the result, then third derivative by differentiating the result of that. If I have the analytic expression for the 5th derivative and I wanted the expression for the 6th derivative, I do not want to work out the 1st, 2nd, 3rd, 4th and then 5th derivative when I've already an of the expression of the 5th derivative!

I will note, it is possible to avoid the problem by using different names at each step but that does not solve the iterative problem.  Is there anyway to force maple to overwrite a function name? Is there a seperate solution? Or is maple just that daft in this case?

 

Thanks for the help,

Hamzaan

Dear Maple users

I am working on a problem, which basicly is dealing with putting n identical marbles in k different boxes. I need to run through all possible combinations and do something with it. The latter is unimportant. Mathematics say there are binomial(n+k-1,k-1) different combinations. I have already produced a recursive procedure to solve the problem and it is displayed below. I have placed a counter in the procedure to control if the procedures get through...

Is there a way to have Maple compute the limit of a recursive sequence? For example, the sequence below

a_n = (a_(n-1) +2)/(a_(n-1) + 3), a_1 =2

is bounded and montonically decreasing, thus has a limit, but Maple is not able to compute the limit. Any ideas?

part of my codes are:
func[1] := (1/2)*(c+s)*x[1]+s*x[3]+(s-c)*x[1]*x[2];
func[2] := (1/2)*(c-s)*x[1]+s*x[3]+(s+c)*x[1]*x[2];
func[3] := -b*x[2]-x[1]^2;
They are just three ODE , how to fix the error?Where is the so-called recursive assignment...?
The program works well when:
"func[1] := x[2] + (x[1]^2 - x[1]*x[3]);
func[2] := - x[1] +  (x[2]^2 + x[1]*x[4]) + x[2]^3;

Hi guys,

let's say that we have an ugly, massive long expression with high power products of variables for example this:

x^10*y^2+x^9*y^8+x^7*y^3+x^5*y+x*y+y

and we want to reduce the powers of these variables using these rules:


Recursive algorithm for finding the sum of the first n odd positive integers.

 procedure   odd_sum n: positive integer )

    if   n = 1   then   return   1

    else   return   

Hello,

1. Is it possible to create a function file in Maple and call the function(file) from the main program(like Matlab?). If yes, please give me an example case.

I want to create a function file which has the general input terms and call the function from another script file without copying/running all the code.

2. Is it possible to run 'recursive function' in maple?

3. How can I create library of my function files?(like in Matlab I can create...

Hello Maple users,

 

i'm trying to get a rekursive sequence like this:

 s:=x->piecewise(x = 1, 1, 1 < x, sum(s(i), i = 1 .. x-1))

 

If i try to get a term of the sequence >1 I get the this error: "Kernel connection has been lost..."

 

I tried varios sequences. All with a sum of the preceding terms crash.

I have to solve the following set of equations. But it allways appears the Error "recursive assignment". Has somebody a solution for me? Is there a Problem with the Equations?

DGL1 := m[1]*(D(D(x[1])))(t)+d[1]*((D(x[1]))(t)-(D(x[2]))(t))+c[1]*(x[1](t)-x[2](t))+e^(-0.4e-1*t)*sin(t)+1.5 = 0;
DGL2 := m[2]*(D(D(x[2])))(t)+d[2]*(D(x[2]))(t)+d[1]*(DF[4]-(D(x[2]))(t))+c[2]*(x[2](t)+x[f])+c[1]*(F[4]-x[2](t)) = 0;

init := (D(x[1]))(0) = 0, x[1](0) = 1.5, x[2](0) = 5;

1 2 Page 1 of 2