
Maple
数学软件
• Maple 教育学术版 • Maple 学生版 • Maple Learn 在线虚拟黑板 • Maple 计算器(手机App) • Maple 专业版 • Maple Flow 计算白板 • Maple 个人版
With a new Calendar package, Maple 2018 makes it easier to work with dates and times, such as analyzing time-dependent data, or calculating the flight duration to your next conference.
Maple 2018 includes new data structures that represent dates and times. There are numerous functions for working with dates and times, including fundamental operations such as date arithmetic and more advanced functionality for working with Calendars. Existing packages such as Finance also support the new Date object.
Dates, Times, and Clocks
> | now := Now( SystemUTCClock ); |
![]() |
> | today := Date( now ); |
![]() |
> | today := Date(); |
![]() |
> | Year( today ); |
![]() |
> | DayOfMonth( today ); |
![]() |
> | Minute( today ); |
![]() |
> | d1 := Date( 2017, 12, 25 ); |
![]() |
> | d2 := Date( 2000, 12, 25 ); |
![]() |
> | t := d1 - d2; |
![]() |
> | convert( t, 'units', 'days' ); |
![]() |
(For more control over the units used in computing the time between two dates, use the DateDifference command in the Calendar package).
> | ( d1 + d2 ) / 2; |
![]() |
> | depart := Date( 2007, 3, 12, 20, 44, 'timezone' = "America/Toronto" ); |
![]() |
> | arrive := Date( 2007, 3, 13, 9, 3, 'timezone' = "Europe/Paris" ); |
![]() |
> | flight_time := arrive - depart; |
![]() |
> | convert( flight_time, 'units', 'hours' ); |
![]() |
The Calendar Package
> | with( Calendar ); |
![]() ![]() |
> | IsLeapYear( 2000 ); |
![]() |
> | IsLeapYear( 1900 ); |
![]() |
> | DayOfWeek( 2017, 12, 25 ); |
![]() |
> | DayOfYear( 2017, 12, 25 ); |
![]() |
> | HostTimeZone(); |
![]() |
> | DateDifference( depart, arrive, 'units' = 'h' ); |
![]() |
> | DateDifference( depart, arrive, 'units' = 'mixed' ); |
![]() |
> | d := Date( 2000, 1, 14, 10, 55, 3 ); |
![]() |
> | AdjustDateField( d, "minute", -3 ); |
![]() |
> | AdjustDateField( d, "month", 30 ); |
![]() |
> | AdjustDateField( d, "month", 30, 'method' = "roll" ); |
![]() |
> | AdjustDateField( d, "month", 30, 'method' = "add" ); |
![]() |