Items tagged with recursive

Feed


Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Question.mw .

Hello, Maple is giving me the error:

"Error, (in simplify/table) too many levels of recursion"
 

Once I take the integral of an expression I am getting the error. It starts at the first integral of the document. 

Note: If I make another maple worksheet and write the expression of the integral without writing it shorthand by substituting the functions in it seems to give me an answer. 

For example instead of the integral of say, y(x)*f(x) I would write out the definitions of the functions in the integral and it would give me an answer while the former would give me the error. 

I have uploaded the document, Any help would be appreciated. I'm not sure if there is a fix or not. Thanks

Question.mw
Download Question.mw

hi every one, i would like to know if it is possible to implement the following recursive sequence in Maple :

q(1)       = q(0)        +q_dot(0)
q_dot(1)  = q_dot(0)  +q_ddot(0)
q_ddot(1) = q_ddot(0)+q_dddot

 

q(2)       = q(1)        +q_dot(1)   = (q(0)+q_dot(0)) + (q_dot(0)+q_ddot(0)) = q(0)+2q_dot(0)+q_ddot(0)
q_dot(2)  = q_dot(1)  +q_ddot(1)
q_ddot(2) = q_ddot(1)+q_dddot

 

q(3)      = q(2)        +q_dot(2)=(q(0)+2q_dot(0)+q_ddot(0))+(q_dot(1)+q_ddot(1))= q(0)+3q_dot(0)+q_ddot(0)+q_dddot
q_dot(3) = q_dot(2)  +q_ddot(2)
q_ddot(3)= q_ddot(2)+q_dddot

I would like every q(n) to be expressed as following : q(n)=q(0)+n_1*q_dot(0)+n_2*q_ddot(0)+n_3*q_dddot.

By computing manually some sequences i am now sure that :
n_1=n
n_2=(n²-n)/2
n_3=?? (I would like to find this one)

The sequence can be written in a more general way as following :
q(n)        = q(n-1) + q_dot(n-1)
q_dot(n)   = q_dot(n-1) + q_ddot(n-1)
q_ddot(n) =q_ddot(n-1)+q_dddot

Can you guys please show me how this can be implementes in Maple ?

Thanks in advance

Hi, I'm new to Maple and I have to produce a recursive procedure with the nomenclature Puis:=proc(X,n::integer) which calculates X^n with:

for n<0   ->   1/(X^(-n))

for n=0  ->   1

for n being an even integer   ->   X^(n/2) * X^(n/2)

for n being an odd integer   ->   X*X^(n-1)

The procedure I produced is:

Puis:=proc(X,n::integer)
option remember;
if n<0 then Puis(X,-n);
elif n=0 then 1;
elif rem(n,2,x)=0 then Puis(X,n);
else X*Puis(X,n-1);
end if;
end proc;

 

i don't have any eror up to this point, but when I try to evaluate, only Puis(4,0) works

Puis(4,-1);
Error, (in content) too many levels of recursion
Puis(4,0);
                               1
Puis(4,3);
Error, (in content) too many levels of recursion
Puis(4,4);
Error, (in content) too many levels of recursion

 

I was wondering what was wrong with my procedure, I changed the 1/(X^(-n)) with X^n and X^(n/2)*X^(n/2) for X^n because it is equivalent. I think I should put some sort of initial value to limit the recursion, but with that kind of function i really don't know how. I also tried with the X^(n/2)*X^(n/2) for the even numbers, but it says Puis expects its 2nd argument, n, to be of type integer, but received 1/2.

 

Hi

I wrote a custom recursive procedure to calculate some value (it is an implementation of a recursive algorithm)
During the further calculations derivatives of this procedure occur. Because of the statements in the specific procedure the automatic diff of a procedure does not work (at least I think that is the reason). However this is no problem as the differentiation is far from simple. L'hopitals rule needs to be used when necessary and Maple cannot detect when it needs to be used automatically (because there is another function, implicitly defined involved).
Therefore I am looking to write my own diff procedure as an extension. From the manual I gathered that this can be done as such `diff/name_of_type' =... however my procedure is not a type and I cannot easily write a 'type/name_of_type' function to define it as such. Can someone help me out?

 

I've made a toy example:

toy_example.mw

I know that in the case of this toy example other ways are possible.
What I need is a way to write my own procedure to evaluate the differential (D[1](A))(1,2,3);

Possibly defining procedure A as a type and writing 'diff/A'=proc...

Thanks

 

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!

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?

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...

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;


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 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.how to plot a equation include two complex variables?

e.g.,0.1501071588582623569e-19 * s1 ^ 2 - 0.1770422954406499377e-11 * s1 ^ 2 * s2 ^ 2 + 0.1526369514180028298e-19 * s2 ^ 2 - 0.8979700309848614490e-12 * s1 ^ 4 - 0.9507487955845430138e-12 * s2 ^ 4 + 0.4941234607542336257e-4 * s1 ^ 4 * s2 ^ 2 + 0.5029096170369867504e-4 * s1 ^ 2 * s2 ^ 4 + 0.1631266049971375518e-4 * s1 ^ 6 + 0.1557291987414385136e-4 * s2 ^ 6 - 0.3925287034197085366e3 * s1 ^ 6 * s2 ^ 2 - 0.5855115617172747465e3...

View 2735_add.mw on MapleNet or Download 2735_add.mw
View file details

Hi

what i want is a procedure to do the following:

given an integer input, add the digits together. if the no. of digits resulting is >1 repeat until a single digit remains.

Page 1 of 1