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

Posted on 2009-04-24
Last Modified: 2012-05-06
I need an array in Mathematica:

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

ai = {Ci, {tStarti, tEndi}}

Is there a way to do this in Mathematica?
Question by:MDKIMZEY
    LVL 26

    Expert Comment

    Array[f, n]
    generates a list of length n, with elements f[i].
    LVL 26

    Expert Comment

    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.

    Author Comment

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

    Accepted Solution

    This link might help answer your additional question.

    Author Comment


    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Title # Comments Views Activity
    Proportion 4 30
    Simple Random Sample 2 43
    Percentage 6 44
    Triangles - Calculating angles 7 30
    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 article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now