# Wolfram Mathematica

## Manned Space Missions

MannedSpaceMissionData provides historic and current information about human space exploration.

In:= `missions = MannedSpaceMissionData[];`

You can create an EventSeries based on the launch date of the missions with vector values storing the mission entity and the duration of each mission.

In:= ```data = DeleteMissing[ MannedSpaceMissionData[ missions, {"LaunchDate", "Entity", "MissionDuration"}], 1, 2];```
In:= `es = EventSeries[data[[All, {2, 3}]], {data[[All, 1]]}]`
Out= TimelinePlot of the time stamps shows the almost-continuous span of manned spaced missions since 1961.

In:= `TimelinePlot[es["Dates"]]`
Out= To analyze the missions' durations, extract the second component of the original event series and convert the values to hours.

In:= `durations = UnitConvert[es["PathComponent", 2], "Hours"]`
Out= The short missions are most common.

In:= ```Histogram[durations, Quantity[{0, 6000, 500}, "Hours"], AxesLabel -> Automatic]```
Out= show complete Wolfram Language input
In:= ```x1 = 250; x2 = 4500; line1 = {{es["FirstDate"], x1}, {es["LastDate"], x1}}; line2 = {{es["FirstDate"], x2}, {es["LastDate"], x2}}; opts = {Joined -> {False, True, True}, Filling -> {1 -> 0}, PlotLabels -> {None, Quantity[x1, "Hours"], UnitConvert[Quantity[N[x2, 4], "Hours"], "Days"]}};```
In:= `DateListPlot[{durations, line1, line2}, opts]`
Out= Compute some descriptive statistics of the mission durations. Note the mean and the median being far apart, indicating a long tail distribution.

In:= ```stats = {Min, Max, Mean, Median}; convert := UnitConvert[N[#], MixedUnit[{"Months", "Days", "Hours", "Minutes"}]] &```
In:= ```TableForm[Map[convert[#[durations]] &, stats], TableHeadings -> {stats}]```
Out//TableForm= The total time that there was a human in space.

In:= ```UnitConvert[Total[durations], MixedUnit[{"Years", "Months", "Days", "Hours", "Minutes", "Seconds"}]]```
Out= 