[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# How would I declare an array {a1, a2, a3, ..., an} in Mathematica?

Posted on 2009-04-24
Medium Priority
793 Views
I need an array in Mathematica:

{ a1, a2, a3, ..., an}

Where:
ai = {Ci, {tStarti, tEndi}}

Is there a way to do this in Mathematica?
Mathematica-7.docx
0
Question by:MDKIMZEY
• 3
• 2

LVL 27

Expert Comment

ID: 24230827
Array[f, n]
generates a list of length n, with elements f[i].
0

LVL 27

Expert Comment

ID: 24230837
Arrays are referred to as "lists" in Mathematica. A list can be declared as such: zlist = {a,b,c}. The elements of zlist can be accessed individually.
0

Author Comment

ID: 24236806
Is there a way in Mathematica to create a variable length array where the array length n has not been specified?
When n is not specified, the expression:
g = Array[a,n_Integer]
throws an error.

0

LVL 27

Accepted Solution

aburr earned 2000 total points
ID: 24237815
-
http://library.wolfram.com/infocenter/Conferences/388/
0

Author Comment

ID: 24243895
ABurr,

One approach I have been playing with is the "double blank" (variable number of arguments)...

f[a__,  t_] := Sum[ pw[a[[i]], t], {i, 1, Length[a] } ]
This may not be the best approach. I will dig into the link you posted.

0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
This is a research brief on the potential colonization of humans on Mars.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
###### Suggested Courses
Course of the Month18 days, 9 hours left to enroll