[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
5
Medium Priority
?
793 Views
Last Modified: 2012-05-06
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
Comment
Question by:MDKIMZEY
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

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

Expert Comment

by:aburr
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

by:MDKIMZEY
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

by:
aburr earned 2000 total points
ID: 24237815
This link might help answer your additional question.
-
http://library.wolfram.com/infocenter/Conferences/388/
0
 

Author Comment

by:MDKIMZEY
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 …
Article by: Nicole
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

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question