ragush

15 Reputation

0 Badges

3 years, 123 days

MaplePrimes Activity


These are replies submitted by ragush

I downloaded your worksheet, right-clicked on line (14) and selected numerical formatting, percent, 2 decimal places. The value changed to 14.40%. I then clicked on !!! to execute the entire worksheet, and it worked fine. There was no hang. I also clicked on the pct_difference expression, and no hang.

 

kernelopts(version); interface(version); kernelopts(system);
Maple 2024.0, APPLE UNIVERSAL OSX, Mar 01 2024, Build ID 1794891

Standard Worksheet Interface, Maple 2024.0, Mac OS X, March 01 2024 Build ID 1794891

"APPLE UNIVERSAL OSX"

I figured it out. The key was the function "AdjustDateField". This function is aware of the number of days in each month, including February in both non-leap and leap years. The code starts at the start date and counts the steps through every succeeding month while the step months are less than or equal to the end date.

Months_Between_Dates.mw

@Preben Alsholm 

Thanks for your response, but that only works if the two dates are a small number of years apart.

If I change the year and month  of d1 to 1974 and 05, that's 50 years which is 600 months, and the number of months DateDifference returns is 618.4434940 which rounds to 618.

Upon further research it appears that Maple uses a lunar month of about 29 days, 12 hours, 44 minutes, 2.8 seconds for its default which accounts for the discrepancy.

https://www.maplesoft.com/support/help/maple/view.aspx?path=Units/time

I'm stumped. It appears that Maple does not count actual months which is what I need. Further, if the dates are 1 day less than an integer number of months apart, then I need Maple to return a number less than that integer.

Page 1 of 1