Defining sequences in mathematica

In summary, you want to define a sequence in mathematica and then let it go, but you are not sure how to tell mathematica to look for the previous number in sequence and then derive the new one. You can do something like this: a_1, a_2, a_3, a_4, a_5 = 3, 7, 23, 87, 343 = 0+3, 3+4, 7+16, 23+64, 87+256
  • #1
heartless
220
2
Hello,
I'd like to define a sequence in mathematica and let it go, but I'm not sure how to tell mathematica to look for the previous number in sequence and then derive the new one.

Something like this,

[tex] a_1, a_2, a_3, a_4, a_5 = [/tex]

[tex] 3, 7, 23, 87, 343 = [/tex]

[tex] 0+3, 3+4, 7+16, 23+64, 87+256 [/tex]

where we start with 3 and add every previous number to the consecutive power of 4.

Thanks,
If you know, please tell as fast as you're able, I'd really need this today.

Thanks ^ ∞

wait and something else,

how to do this
I have a function f.ex f(x) = log[x]
but now I'd like to graph the functions
f(f(f(f(f(x)))))) up to a certain number of times, for example 100 such functions
and then give off all the values starting with x=10.

Any ideas?

PLease help me, I really need this, or otherwise I shall be tortured to the end of my little life.
 
Last edited:
Physics news on Phys.org
  • #2
Alright, I know. But anyway, I'd still like to see your way.
 
  • #3
Don't use mathematica (I know it has a programming language tho), and am just learning the very basics of programming myself but isn't there some way of doing this?:

make variables a,b,c,d
make an array
a = 3
c = 1
d = 4
put 3 into the first position in the array

make a loop for c < 100
Print a
Assign to b the value of a + d then increment c by one
Let d = d*4
put the value of b into the (c)th position in the array
a=b
start over until c =100
print a
Plot the values in the array against its position in the array


Disclaimer: Most of this may be garbage...I apologise if it is but I'm a novice at the moment

*edit* changed (c+1)th to (c)th
 
Last edited:
  • #4
That would define an array with 100 entries. The n'th entry would have the correct property, but that array is no more the sequence than the set of numbers {1,..,100} is the set of natural numbers.

A complete guess would be that a sensible programming language converts an infinite list to either a function f(n)=3 + (4^n - 1)/3 -1 in this case, or stores the recursive formual x(1)=3, x(n)=x(n-1) + 4^(n-1), and will call some procedure for evaluating it at some n as required. Though how you do that in any particular language if at all is not something I know.
 
  • #5
matt grime said:
That would define an array with 100 entries. The n'th entry would have the correct property, but that array is no more the sequence than the set of numbers {1,..,100} is the set of natural numbers.

Aye that is true :redface: ...apart from letting c be a number such that the computer would perish long before it was ever reached...or the user just gives up, I couldn't suggest a way to let it just keep going...but even then I'm not defining the complete sequence, just a rule to make it print *some* of them. :redface:
 
Last edited:

1. What is a sequence in mathematica?

A sequence in mathematica is a list of objects that follow a specific order. It can contain any type of object, such as numbers, symbols, or even functions. Sequences are useful for representing patterns and performing calculations.

2. How do you define a sequence in mathematica?

To define a sequence in mathematica, you can use the "Table" function or the "Range" function. The "Table" function allows you to specify the elements of the sequence explicitly, while the "Range" function creates a sequence based on a starting value, ending value, and step size.

3. Can sequences have infinite length in mathematica?

Yes, sequences in mathematica can have infinite length. This is useful when working with mathematical concepts that involve infinite series or when creating functions that generate infinite sequences.

4. How do you access elements in a sequence in mathematica?

You can access elements in a sequence in mathematica by using the double bracket notation, such as seq[[n]], where "seq" is the name of the sequence and "n" is the index of the element you want to access. You can also use the "Part" function, which has the syntax Part[seq, n].

5. What are some common operations that can be performed on sequences in mathematica?

Some common operations that can be performed on sequences in mathematica include finding the length of a sequence, concatenating two sequences, and applying functions to each element in a sequence. You can also use built-in functions, such as "Select" and "Sort", to filter and sort sequences based on certain criteria.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
227
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
278
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
26K
  • Topology and Analysis
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
2
Replies
51
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top