12.07.2015 Views

Calculer un calendrier avec LATEX, le dessiner en 3D avec PSTricks

Calculer un calendrier avec LATEX, le dessiner en 3D avec PSTricks

Calculer un calendrier avec LATEX, le dessiner en 3D avec PSTricks

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Calcu<strong>le</strong>r</strong> <strong>un</strong> <strong>ca<strong>le</strong>ndrier</strong> <strong>avec</strong> L A TEX,<strong>le</strong> <strong>dessiner</strong> <strong>en</strong> <strong>3D</strong> <strong>avec</strong> <strong>PSTricks</strong> (version 0.47)Manuel LuqueNovember 9, 20051


JANVIERL M M J V S D2 3 4 5 6 7 89 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 312006MARSL M M J V S D11 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 312006MAIL M M J V S D1 2 3 4 5 6 78 9 10 11 12 13 1415 16 17 18 19 20 2122 23 24 25 26 27 2829 30 312006FEVRIERL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 282006AVRILL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 302006JUINL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 302006


JUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 312005SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 302005NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302005AOUTL M M J V S D1 2 3 4 5 6 78 9 10 11 12 13 1415 16 17 18 19 20 2122 23 24 25 26 27 2829 30 312005OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312005DECEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30 312005


31AVRILL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 302005200524 25 26 27 28 29 3017 18 19 20 21 22 2310 11 12 13 14 15 161 23 4 5 6 7 8 9JANVIERL M M J V S DMAIL M M J V S D2 3 4 5 6 7 89 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 3120051JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005JUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 312005NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 3020051 Objectifs, outils et méthodes adoptés1.1 ObjectifsIl s’agissait de calcu<strong>le</strong>r <strong>avec</strong> L A TEX, <strong>un</strong> <strong>ca<strong>le</strong>ndrier</strong> valab<strong>le</strong> de l’an 2 000 à l’an 2 099 (je suis optimiste), puisd’adopter <strong>un</strong>e méthode origina<strong>le</strong> de représ<strong>en</strong>tation <strong>en</strong> <strong>3D</strong>, <strong>en</strong> plaçant chaque mois sur l’<strong>un</strong>e des faces d’<strong>un</strong>dodécaèdre. Un <strong>ca<strong>le</strong>ndrier</strong> de ce type était, il y quelques années, offert par <strong>le</strong>s visiteurs médicaux des laboratoiresPfizer.1.2 Outils adoptésIl existe déjà <strong>un</strong> <strong>ca<strong>le</strong>ndrier</strong> écrit <strong>en</strong> L A TEX, dont <strong>le</strong>s calculs sont faits directem<strong>en</strong>t <strong>en</strong> TEX. Il s’agit de ca<strong>le</strong>ndar,écrit par Michael Barret et disponib<strong>le</strong> sur <strong>le</strong> serveur du CTAN ; c’est très bi<strong>en</strong> fait.Un <strong>ca<strong>le</strong>ndrier</strong> <strong>en</strong> <strong>3D</strong>, dessiné <strong>avec</strong> <strong>PSTricks</strong>, est déjà proposé depuis plusieurs d’années par D<strong>en</strong>is Girou sur: http://tug.org/applications/<strong>PSTricks</strong>/More.Donc, ri<strong>en</strong> de neuf, mais revu à ma façon : pour ma part j’ai décidé d’utiliser <strong>le</strong>s macros du package fp deMichael Mehlich, qui form<strong>en</strong>t <strong>un</strong> excel<strong>le</strong>nt outil de calcul. La <strong>le</strong>cture du code écrit <strong>avec</strong> ce package est pluscompréh<strong>en</strong>sib<strong>le</strong> que celui écrit <strong>en</strong> TEX de base.Pour la représ<strong>en</strong>tation <strong>en</strong> 3d, j’ai aussi, utilisé <strong>PSTricks</strong> de Timothy Van Zandt, et <strong>en</strong> particulier l’ext<strong>en</strong>sionpst-3d.1.3 Méthode adoptéeLa méthode de calcul des jours de semaine du <strong>ca<strong>le</strong>ndrier</strong> est déduite de quelques observations :1. Le 1 janvier 2 000 est <strong>un</strong> samedi. On adopte la conv<strong>en</strong>tion de représ<strong>en</strong>ter <strong>le</strong>s jours de semaine par <strong>un</strong>numéro : j’ai choisi :l<strong>un</strong>di mardi mercredi jeudi v<strong>en</strong>dredi samedi dimanche1 2 3 4 5 6 7


2. Une année ordinaire compr<strong>en</strong>d 365 jours, or 365 = 52 × 7 + 1. Il y a donc <strong>un</strong> décalage de 1 jour dans <strong>le</strong>nom des jours pour l’année suivante si el<strong>le</strong> est ordinaire el<strong>le</strong> aussi. Autrem<strong>en</strong>t dit <strong>le</strong> 1 janvier 2 001 devraitêtre <strong>un</strong> dimanche (6 + 1 = 7). Or l’an 2 000 est bissexti<strong>le</strong> et comporte 366 jours : <strong>le</strong> décalage sera de 2, <strong>le</strong>1 janvier 2 001 correspondra au numéro 6 + 2 = 8 = 1 (modulo 7).3. Sur la période ret<strong>en</strong>ue 2 000/2 099 <strong>le</strong>s années divisib<strong>le</strong>s par 4 : 2 000, 2 004, 2 008 etc. sont bissexti<strong>le</strong>s. Ondéterminera donc si l’année choisie est bissexti<strong>le</strong> <strong>en</strong> testant si el<strong>le</strong> est <strong>un</strong> multip<strong>le</strong> de 4.% test d’<strong>un</strong>e année bissexti<strong>le</strong>\FPeval{\YearBissextil}{(\psk@Ca<strong>le</strong>ndrierA)/4}\FPtr<strong>un</strong>c{\YearBissextil}{\YearBissextil}{0}\FPeval{\YearBissextil}{(\YearBissextil)*4}\FPtr<strong>un</strong>c{\YearBissextil}{\YearBissextil}{0}\ifnum\YearBissextil=\psk@Ca<strong>le</strong>ndrierAetc.4. Pour <strong>un</strong>e année choisie, on calcu<strong>le</strong>ra <strong>le</strong> décalage par rapport à 2 000, <strong>en</strong> comptant <strong>le</strong>s années et <strong>en</strong> ajoutant1 chaque fois qu’il y aura dans cet interval<strong>le</strong> <strong>un</strong>e année bissexti<strong>le</strong> (<strong>en</strong> t<strong>en</strong>ant compte de 2 000).5. On reti<strong>en</strong>t pour <strong>le</strong> début de chaque mois :2 L’utilisationmois année ordinaire année bissexti<strong>le</strong>janvier 1 1février 32 32mars 60 61avril 91 92mai 121 122juin 152 153juil<strong>le</strong>t 182 183août 213 214septembre 244 245octobre 274 275novembre 305 306décembre 335 3362.1 Utilisation simp<strong>le</strong>Si on veut voir <strong>un</strong>iquem<strong>en</strong>t <strong>le</strong> mois de l’année choisie, on fera, par exemp<strong>le</strong> :\psCa<strong>le</strong>ndar[An=2099,Mois=12,Jour=25,MoisChoisi=12]


DECEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 312099Cette étude ne teste pas si <strong>le</strong>s va<strong>le</strong>urs introduites pour l’année(An) et <strong>le</strong> mois(Mois), sont correctes !Par défaut, la commande \psCa<strong>le</strong>ndar affiche <strong>le</strong> mois et l’année <strong>en</strong> cours et <strong>en</strong>toure la date du jour (suggestionde Jean-Michel Sarlat).Si on veut voir afficher, <strong>un</strong> jour d’<strong>un</strong> mois particulier, on rajoutera <strong>le</strong> paramètre MoisChoisi=va<strong>le</strong>ur auxautres, comme dans l’exemp<strong>le</strong> précéd<strong>en</strong>t et <strong>le</strong> suivant.NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302005\psCa<strong>le</strong>ndar[An=2004,Mois=6,Jour=21,MoisChoisi=6]


2.2 Le <strong>ca<strong>le</strong>ndrier</strong> <strong>en</strong> <strong>3D</strong>La commande s’écrit très simp<strong>le</strong>m<strong>en</strong>t :\psCalDodecaederJUINL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302004JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005200521 22 23 24 25 26 2714 15 16 17 18 19 207 8 9 10 11 12 1328FEVRIERL M M J V S D1 2 3 4 5 6MARSL M M J V S D7 8 9 10 11 12 131 2 3 4 5 614 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 312005JANVIERL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 303120051MAIL M M J V S D1 2 3AVRILL M M J V S D4 5 6 7 8 9 1016 17 18 19 20 21 229 10 11 12 13 14 15 152 3 4 5 6 7 811 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30200523 24 25 26 27 28 2930 312005pour avoir <strong>le</strong> <strong>ca<strong>le</strong>ndrier</strong> de l’année <strong>en</strong> cours. Si <strong>le</strong> schéma est trop grand à votre goût, <strong>en</strong>cadrez la commandepar <strong>un</strong> \pssca<strong>le</strong>box{0.5}{\psCalDodecaeder}Pour avoir <strong>le</strong> mois de mai face à soi, on écrira, par exemp<strong>le</strong> :\pssca<strong>le</strong>box{0.5}{\psCalDodecaeder[sty<strong>le</strong>=mai]}


31AVRILL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 302005200524 25 26 27 28 29 3017 18 19 20 21 22 2310 11 12 13 14 15 161 23 4 5 6 7 8 9JANVIERL M M J V S DMAIL M M J V S D2 3 4 5 6 7 89 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 3120051JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005JUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 312005NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302005Vx, Vy, Vz sont <strong>le</strong>s va<strong>le</strong>urs des paramètres de viewpoint=-5.85 -3.62 0 de la commande \ThreeDput depst-3d, qui sont <strong>le</strong>s coordonnées d’<strong>un</strong> vecteur définissant la direction où se trouve l’observateur (la direction dela projection parallè<strong>le</strong>).On jouera aussi sur <strong>le</strong> paramètre viewang<strong>le</strong>, pour am<strong>en</strong>er la face observée dans <strong>le</strong> bon s<strong>en</strong>s de la <strong>le</strong>cture.Pour avoir <strong>le</strong> mois de janvier face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=janvier]}JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005FEVRIERL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27282005MARSL M M J V S D7 8 9 10 11 12 131 2 3 4 5 614 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 312005JANVIERL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 303120051MAIL M M J V S D1 2 3AVRILL M M J V S D4 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 302005200530 3123 24 25 26 27 28 299 10 11 12 13 14 15 1516 17 18 19 20 21 222 3 4 5 6 7 8Pour avoir <strong>le</strong> mois de février face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=fevrier]}


AOUTL M M J V S D3117 18 19 20 21 22 2324 25 26 27 28 29 30L M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 162005JANVIERJUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005FEVRIERL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728MARSL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27 2728 29 30 3120052005OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312005SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 302005Pour avoir <strong>le</strong> mois de mars face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=mars]}FEVRIERL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27282005MARSL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 3120051 2JANVIERL M M J V S D3 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312005AVRILL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 302005200529 30 312005SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 301 2 3 4 5 6 78 9 10 11 12 13 1415 15 16 17 18 19 20 2122 23 24 25 26 27 28Pour avoir <strong>le</strong> mois d’avril face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=avril]}


1 2L M M J V S DJANVIER3 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 3031MARSL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27 2728 29 30 3120052005AVRILL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30MAIL M M J V S D12 3 4 5 6 7 89 10 11 12 13 14 15 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 31200520051 2 3 4 5 6 78 9 10 11 12 13 1415 15 16 17 18 19 20 2122 23 24 25 26 27 2829 30 312005JUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 312005AOUTL M M J V S DPour avoir <strong>le</strong> mois de juin face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=juin]}MAIL M M J V S D12 3 4 5 6 7 89 10 11 12 13 14 15 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 312005JANVIERM M 10 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30L J V S D1 23 4 5 6 7 8 9312005JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005FEVRIERL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27282005NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30200531OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 302005Pour avoir <strong>le</strong> mois de juil<strong>le</strong>t face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=juil<strong>le</strong>t]}


MARSL M M J V S D2005NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302005DECEMBREM M 10 1112 13 14 15 16 17 1819 20 21 22 23 24 26 27 28 29 30 31L J V S D1 2 3 45 6 7 8 9 25JUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 31AOUTL M M J V S D1 2 3 4 5 6 78 9 10 11 12 13 1415 15 16 17 18 19 20 2122 23 24 25 26 27 2829 30 3120052005MAIL M M J V S D12 3 4 5 6 7 89 10 11 12 13 14 15 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 312005AVRILL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 302005Pour avoir <strong>le</strong> mois d’août face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=aout]}L M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 25 2526 27 28 29 30 312005DECEMBREJUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 312005AOUTL M M J V S D1 2 3 4 5 6 78 9 10 11 12 13 1415 16 17 18 19 20 2122 23 24 25 26 27 2829 30 312005SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30200520052005AVRILL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 301 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27 2728 29 30 31Pour avoir <strong>le</strong> mois de septembre face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=septembre]}


FEVRIERL M M J V S DAOUTL M M J V S D1 2 3 4 5 6 78 9 10 11 12 13 1415 15 16 17 18 19 20 2122 23 24 25 26 27 2829 30 312005DECEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30 312005SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 3031200520052005200528MARSL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27 2728 29 30 311 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27Pour avoir <strong>le</strong> mois d’octobre face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=octobre]}DECEMBREL M M J V S D5 6 7 8 9 10 1112 13 14 15 16 17 181 2 3 419 20 21 22 23 24 2526 27 28 29 30 31SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 3020052005OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312005NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302005FEVRIERL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 27282005JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 302005Pour avoir <strong>le</strong> mois de novembre face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=novembre]}


MAIL M M J V S DNOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302005OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312005200526 27 28 29 30 3119 20 21 22 23 24 2512 13 14 15 16 17 18NOVEMBREL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 305 6 7 8 9 10 111 2 3 4DECEMBREL M M J V S DJUILLETL M M J V S D1 2 34 5 6 7 8 9 1011 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 3120052005JUINL M M J V S D1 2 3 4 56 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 3020052 3 4 5 6 7 89 10 11 12 13 14 15 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 31 20051Pour avoir <strong>le</strong> mois de décembre face à soi, on écrira :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=decembre]}JUILLETM M 11 12 13 14 15 16 1718 19 20 21 22 23 2425 26 27 28 29 30 31L J V S D1 2 34 5 6 7 8 9 102005AOUTL M M J V S D1 2 3 4 5 6 78 9 10 11 12 13 1415 15 16 17 18 19 20 2122 23 24 25 26 27 2829 30 312005DECEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30 312005SEPTEMBREL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 302005OCTOBREL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312005Pour visualiser <strong>un</strong>e année particulière, <strong>avec</strong> <strong>un</strong> mois choisi face à soi, et <strong>un</strong> jour de ce mois, (15 mai 2004) onfera :\pssca<strong>le</strong>box{0.35}{\psCalDodecaeder[sty<strong>le</strong>=mai,An=2004,MoisChoisi=5,Jour=15]}


NOVEMBREL M M J V S DAVRILL M M J V S D1 2 3 45 6 7 8 9 10 11 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 302004200426 27 28 29 30 3119 20 21 22 23 24 2512 13 14 15 16 17 185 6 7 8 9 10 111 2 3 4JANVIERL M M J V S DMAIL M M J V S D1 23 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30312004JUINL M M J V S D1 2 3 4 5 67 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 302004JUILLETL M M J V S D1 2 3 45 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30 3120041 2 3 4 5 6 78 9 10 11 11 12 13 1415 16 17 18 19 20 2122 23 24 25 26 27 2829 3020043 Calcul de la date de PâquesOn trouve sur internet, à propos de ce sujet de nombreux sites. Á partir de la définition de la fête proprem<strong>en</strong>tdite, <strong>le</strong>s formu<strong>le</strong>s « magiques » abond<strong>en</strong>t. L’<strong>un</strong>e d’el<strong>le</strong> a ret<strong>en</strong>u mon att<strong>en</strong>tion, je l’ai retranscrite <strong>avec</strong> <strong>le</strong> packagefp. Dans l’ordre, <strong>un</strong> aperçu de la page, puis <strong>le</strong> codage des calculs <strong>avec</strong> fp.Le site : http://www.altcal.com/elmcal.html, et <strong>un</strong> extrait :Version 2.0 - 11 Nov 1998Copyright and disclaimer------------------------This docum<strong>en</strong>t is Copyright (C) 1998 by Claus Tondering.E-mail: claus@tondering.dk.The docum<strong>en</strong>t may be freely distributed, provided thiscopyright notice is included and no money is charged forthe docum<strong>en</strong>t.This docum<strong>en</strong>t is provided "as is". No warranties are made asto its correctness.G = year mod 19For the Julian ca<strong>le</strong>ndar:I = (19*G + 15) mod 30J = (year + year/4 + I) mod 7For the Gregorian ca<strong>le</strong>ndar:C = year/100H = (C - C/4 - (8*C+13)/25 + 19*G + 15) mod 30I = H - (H/28)*(1 - (H/28)*(29/(H + 1))*((21 - G)/11))J = (year + year/4 + I + 2 - C + C/4) mod 7Thereafter, for both ca<strong>le</strong>ndars:L = I - JEasterMonth = 3 + (L + 40)/44EasterDay = L + 28 - 31*(EasterMonth/4)\FPset{\Year}{1981} % placer ici l’année\FPeval\GY{(\Year)-19*tr<strong>un</strong>c((\Year)/19,0)}\FPeval{\C<strong>en</strong>t}{tr<strong>un</strong>c((\Year)/100,0)}


\FPeval{\Iter}{tr<strong>un</strong>c((\C<strong>en</strong>t)-tr<strong>un</strong>c((\C<strong>en</strong>t)/4,0)-tr<strong>un</strong>c((8*(\C<strong>en</strong>t)+13)/25,0)+(\GY)*19+15,0)}\FPeval{\Iterdiv}{tr<strong>un</strong>c((\Iter)/30,0)}\FPeval\Hepact{(\Iter)-30*(\Iterdiv)}\FPeval\Inbre{tr<strong>un</strong>c((\Hepact)-tr<strong>un</strong>c((\Hepact)/28,0)*(1-tr<strong>un</strong>c((\Hepact)/28,0))*(tr<strong>un</strong>c(29/((\Hepact)+1),0)*tr<strong>un</strong>c((21-(\GY))/11,0)),0)}\FPeval\Jnbreinter{tr<strong>un</strong>c((\Year)+tr<strong>un</strong>c((\Year)/4,0)+(\Inbre)+2-(\C<strong>en</strong>t)+tr<strong>un</strong>c((\C<strong>en</strong>t)/4,0),0)}\FPeval\Jnbre{tr<strong>un</strong>c((\Jnbreinter)-7*tr<strong>un</strong>c((\Jnbreinter)/7,0),0)}\FPeval\Lnbre{tr<strong>un</strong>c((\Inbre)-(\Jnbre),0)}\FPeval\Month{tr<strong>un</strong>c(3+tr<strong>un</strong>c(((\Lnbre)+40)/44,0),0)}\FPeval\Day{tr<strong>un</strong>c((\Lnbre)+28-31*tr<strong>un</strong>c((\Month)/4,0),0)}\ifnum\Month=4\ifnum\Day>25 \FPeval{\Day}{tr<strong>un</strong>c((\Day)-7,0)} \fi\fiP\^aques <strong>le</strong> Dimanche \FPprint\Day/\FPprint\Month/\FPprint\YearPâques tombe <strong>le</strong> dimanche 19/4/1981Vous y reconnaîtrez sans peine l’algorithme initial, j’ai rajouté <strong>le</strong>s trois dernières lignes, car l’auteur desformu<strong>le</strong>s précéd<strong>en</strong>tes semb<strong>le</strong> avoir oublié que Pâques peut varier seu<strong>le</strong>m<strong>en</strong>t <strong>en</strong>tre <strong>le</strong> 22 mars et <strong>le</strong> 25 avril inclusSans cette correction, <strong>le</strong> programme affiche dans l’exemp<strong>le</strong> précéd<strong>en</strong>t (1981), <strong>le</strong> dimanche 26 avril au lieu du19 avril.Pour <strong>le</strong> tester quelques dates :1978 26 mars1979 15 avril1980 6 avril2000 23 avril2002 31 mars2003 20 avrilCe n’est pas garanti sans erreurs, l’emploi des fonctions tr<strong>un</strong>c ou ro<strong>un</strong>d ou clip ne donn<strong>en</strong>t pas à 100%toujours, <strong>le</strong> résultat att<strong>en</strong>du. Par exemp<strong>le</strong> si fp calcu<strong>le</strong> 14.99999999, alors que de toute évid<strong>en</strong>ce c’est 15, ilne vaut mieux pas faire tr<strong>un</strong>c pour avoir la partie <strong>en</strong>tière, mais ro<strong>un</strong>d, car sinon on commet <strong>un</strong>e erreur d’<strong>un</strong>e<strong>un</strong>ité <strong>en</strong> moins ! Il faudrait donc prévoir de tester ces cas !4 Que reste-t-il à faire ? Problèmes !• Placer <strong>le</strong>s jours fériés du l<strong>un</strong>di de Pâques et du l<strong>un</strong>di de P<strong>en</strong>tecôte.• Dessiner automatiquem<strong>en</strong>t <strong>le</strong> mois <strong>en</strong> cours, face à notre regard.• Prévoir <strong>un</strong> test qui limite l’année choisie à l’interval<strong>le</strong> permis, soit [2000 − 2099].• Trouver <strong>un</strong> moy<strong>en</strong> simp<strong>le</strong>, élégant et cohér<strong>en</strong>t d’<strong>en</strong>tourer la date choisie.• Débusquer <strong>le</strong>s erreurs, si vous <strong>en</strong> trouvez. . .

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!