Sadly that wants to make a matrix of two long rows ;) like the hcat(...). So needs the transpose as well ... maybe this is the way? Thanks for opening my eyes to mapreduce though!
On Tuesday, 27 October 2015 09:43:59 UTC-7, Glen O wrote: > > One relatively neat way to do this is > > mapreduce(exact,hcat,linspace(0,10,100)) > > On Wednesday, 28 October 2015 02:38:56 UTC+10, Gabriel Gellner wrote: >> >> Okay sorry tab seems to send ... >> >> I am trying my to figure out the Julian way to create a table of values >> (matrix) from a function that returns multiple values. As this is really >> thinking about the problem as a function that generates the rows of the >> table it feels super awkward to do this in Julia currently. For example, >> lets say I have a function of the form: >> >> function exact(t) >> yout = zeros(2) >> yout[1] = 3.0*exp(t) - 2.0*exp(t) >> yout[2] = exp(t) + 2.0*exp(t) >> yout >> end >> >> then what i want is a matrix of these solutions so my first thought is to >> do >> >> esol = [exact(t) for t in linspace(0, 10, 100)] >> hcat(esol...)' >> >> is this the idiomatic solution? >> >> Is there a better way to do this? How do people generally deal with Array >> or Arrays. Feels weird to me currently. >> >> Gabriel >> >> >> On Tuesday, 27 October 2015 09:31:22 UTC-7, Gabriel Gellner wrote: >>> >>> I am trying my to figure out the Julian way to create a table of values >>> (matrix) from a function that returns multiple values. As this is really >>> thinking about the problem as a function that generates the rows of the >>> table it feels super awkward to do this in Julia currently. For example, >>> lets say I have a function of the form: >>> >>> function exact_solution(t) >>> >>>
