Items tagged with sequence

Feed

Hi MaplePrimes,

another_recursive_sequence.mw

another_recursive_sequence.pdf

These two files have the same content.  One is a .pdf and the other is a Maple Worksheet.  I explore integer sequences of the form - 

a(r) = c*a(r-1)+d*a(r-2) with a(1) and a(2) given.

Some of these sequences are in (the Online Encyclopedia of Integer Sequences) OEIS.org and some are not.  If we restrict c to 1 and assume that a(1)=1 and a(2) = 2 we have the parameter d remaining.  See additional webpage - 

https://sites.google.com/site/recrusivefunction/

Let me know if you like the code.

Regards,

Matt

 

Hi Mapleprimes people and robots,


My question is regarding a recursive sequence.  It can be defined non-recursively as - 


a(r) :=  0.8*3^r + 0.2*(-2)^r.

The first few terms are - 

1,2,8,20,68,188, and so on.

Here is my Maple Worksheet.
recursive_sequence_A133467.mw      recursive_sequence_A133467.pdf

I want some Maple code that will produce 30 terms of this sequence.  It is defined as

s[1]:=1:
s[2]:=2:

for n>2 we let s[n] = s[n-1] + 6*s[n-2].

Let me know if my question does not make sense.

Regards,
Matt

 

In Mathematica, there is a command "LinearRecurrence" that lists a sequence generated by a linear recurrence.
For example, 
LinearRecurrence[{-3, 1}, {7, 2}, 10]
will produce the first ten numbers in the sequence defined by a0=7, a1=2; a_n = -3 an-1 + an-2.

Is there anything similar in Maple? 
If not, what would be the easiest way to do the same?

UPDATE: Two answers show how to do this example with rsolve, but it seems that this solution does not help in general for recurrence of high order.

Thank you.

Can somebody please expand the following double sum to produce a list of sequences?

(Sum(f[i], i = 0 .. 1))*(Sum(g[i, j, k], j = 0 .. 1)) for k = {1,2}

I need to make sure the operation order is correct, so I would like to verify my workings.

Thanks!

I'm trying to generate 100 equation to solve them numerically , buy maple won't let me , here's the code :

for i by 0 to 99 do
a := a[i]+a[i+1] = i^2
end do ;

Why do you need `or` in an if-test if say:

if `or`(seq(R[i]=R[k], k=1..i-1)) then
.......
end if;

If I run the test without the `or` (Boolean type logical, I know) it does not work.

Can anyone help me?

Hi all,
I have a question about editing strings in Maple2016.
When I make a variable "DataName" which is as below in Maple worksheet,
DataName:=Array(["Data1","Data2","Data3"]):

I want to make the variable "DataSet" whose elements are as below.
DataSet:=[1="Data1",2="Data2",3="Data3"]

Of course I can type the elements of "DataSet", but if the number of DataName increases, it requires a lot of time to do that, so I want to make the "DataSet" by using general command so that I can obtain "DataSet" automatically.
I tried to use the command "cat", "||", "map", and so on... but I could not find how to do that.
Is there anyone who can solve this problem? Please let me know how to solve this problem. I appreciate any idea you may have.

Always thanks for the nice answer

Dear all

I have n, p two integers greater than one

I would like to minimize the following real number by a fixed positive constant if its possible

(n/(n+p))^(n/p)-(n/(n+p))^((n+p)/p)

Many thanks

I'm displaying a series of point plots as an animation, and would like to update a displayed parameter as well.  I have a nested list L[t] where there's a set of points for each t, and for each t there's also a numerical value M that I'd like to display.  (In my real problem, L[t] is the number of particles in each of several states, and M is the rms deviation from am algebraic probability distribution.)  

The closest I've gotten (for a simple L and M) is the following, but it displays all of the M values in the legend at once:

with(plots); with(Statistics);

L := [[1, 2, 3, 4, 5, 6], [2, 4, 6, 8, 10, 12]];

M := [1, 2];

display([seq(PointPlot(L[t], legend = M[t]), t = 1 .. 2)], insequence = true)

 

I don't need this to be in the legend.  Is there a way to display only the current value of M for each t?  Thanks very much.

Hi,

I'm currently writing my thesis and actually haven't used Maple before.

I've got the following problem with converting the results of a sequence:

seq(Optimization:-Maximize(function with 2 variables), parameter:0..1,0.1)

The results are ok, but I can't convert the values to a spreadsheet with 4 columns (parameter value, maximum value, value of variable 1, value of variable 2).

Thank you!

Best regards

When using seq function below in the second call, it does not generate a sequence of functions with 'a' being 1, 2, and 3, and I had expected. 

First seq function call is just to show that it works without the function "x ->" wrapping.

I could of couse use unapply as in the third call, but I had expected the second call to work.

Am I doing anything wrong, or is this a Maple bug?

Hello

Any idea about the summation of Fibonacci sequence

 

Fibonacci.mw

 

Best regards

 

i'm using maple in a research but i want to add a recursive function h_m(t) in 2 case : if m is integer positive and not, 
la formule est donnée comme suit :  if (mod(m,1) = 0  and m>0) then  h:=proc(m,t)  local  t ;  h[0,t]:=t ;   for  i from -4 to  m  by  2 do  h [m,t]:= h[0, t]-(GAMMA(i/(2)))/(2*GAMMA((i+1)/(2)))*cos(Pi*t)*sin(Pi*t)  od:  fi:  end; 
  if (mod(m,1) = 0  and m>0) then  h:=proc(m,t)  local  t ;  h[0,t]:=t ;   for  i from -4 to  m  by  2 do  h [m,t]:= h[0, t]-(GAMMA(i/(2)))/(2*GAMMA((i+1)/(2)))*cos(Pi*t)*sin(Pi*t)  od:  fi:  end;
and i wanna to know how to programmate a Gaus Hypegeometric function. Thank You

 

I need to do this with a sequence of a large number of elements but here is my question with a sequence of fewer elements.

a:={10,11,-13,9,20,74,10}:

I want to check each element of the sequence if it is negative. And if any element is negative I want to replace with 0 (or do something else). I tried the following code but it didn't work. 

for k from 1 to 7 do
  if (a[k]<0) then subs(a[k]=0, a) end if:
end do;

Please help me to figure it out. 

Hello,

Paraphrasing:

https://en.m.wikipedia.org/wiki/Langford_pairing

given a sequence of 2n numbers 1,1,2,2,3,3,...n,n in which the two 1's are 1 slot apart, the two 2's are 2 slots apart, the two 3's are 3 slots apart, -> generally the two n's are n slots apart.

for n=3, a possible sequence is [2,3,1,2,1,3]. 

There is sequences for n=4,7,8...

i havent a clue how to write a maple procedure to generate a sequence for given n, but I'm hoping an expert here can.

1 2 3 4 5 Page 1 of 5