Re: problem of syntax.
- To: mathgroup at smc.vnet.net
- Subject: [mg104370] Re: problem of syntax.
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Thu, 29 Oct 2009 02:58:07 -0500 (EST)
- References: <hc91nu$e3r$1@smc.vnet.net>
micmac wrote:
> Hello everyone,
>
> For some reasons, I have a matrix where each element is itself another
> matrix of size one.
> How can I transform that in a normal matrix where each element is just the
> value ?
>
> I am very confused with mathematica syntax.
>
> thanks,
>
> Julien
>
>
>
Given a nested list structure such as you describe, probably the easiest
way to transform it is with Map:
In[6]:= start = {{{10}, {20}}, {{30}, {40}}};
In[13]:= Map[First, start, {2}]
Out[13]= {{10, 20}, {30, 40}}
Maybe the real question you need to ask is how you got that structure in
the first place - you say "for some reasons". Tell us how you got there
and we can fix your real problem!
Regarding Mathematica syntax, I would strongly recommend spending a few
hours exploring the syntax before plunging into solving a specific
problem of your own. Try the tutorials and/or type "lists" into the help
system, and follow the various tutorial-style links such as
"constructing lists". Remember that you can cut and paste the help
examples into a notebook of your own. If you do this, you will quickly
build up a collection of recipes to help you with your own work.
Mathematica syntax is extremely logical and easy to use even if it
appears hard at first - so persevere a bit. If all else fails, go on a
short course.
David Bailey
http://www.dbaileyconsultancy.co.uk