¼ø¶È»ñÎÁ/09
Ruby: ½àÈ÷ †
Ruby ¤Ï Processing ¤è¤ê¤Ï¾¯¤·ËܳÊÇÉ¤Ê¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¤Ç¡¤²èÁü¤ä²»À¼¤Î½èÍý¤è¤ê¤â·×»»¤äʸ»úÎó½èÍý¡¤ÏÀÍýŪ¤ÊÆ°ºî¤Ë¸þ¤¤¤Æ¤¤¤ë¤¤ê¤À¡¥ ¤Ä¤Þ¤ê¡¤
¤½¤Îʬ¡¤ºÇ½é¤ÏÍøÍѤ¹¤ë¤¿¤á¤Î¼ê½ç¤Ê¤É¤ò¾¯¤·ÌÌÅݤ˴¶¤¸¤ë¤«¤â¤·¤ì¤Ê¤¤¤¬¡¤¤¹¤°´·¤ì¤ë¤Î¤Ç¿´ÇÛ¤ÏÉÔÍפÀ¡¥
½àÈ÷: ÀìÍѤΥǥ£¥ì¥¯¥È¥ê¤òºî¤Ã¤Æ¤ª¤³¤¦ †
Processing ¤ÎºÇ½é¤Î»þƱÍÍ¡¤Ruby ÀìÍѤ˥ǥ£¥ì¥¯¥È¥ê¤ò¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¤Î²¼¤Ëºî¤Ã¤Æ¤ª¤³¤¦¡¥ ¤³¤Î web ¤Ç¤Ï¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î̾Á°¤ò lec_ruby ¤È¤·¤Æ¤ª¤¯(³§¤Ï¼«Ê¬¤Ç¹¥¤¤Ê̾Á°¤ò¤Ä¤±¤è¤¦. ¤¿¤À¤·¡¤¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤ä¿ô»ú°Ê³°¤ò»È¤¦¤È¤¢¤È¤ÇÁêÅö¶ìÏ«¤¹¤ë¤«¤â¤è¡Ä).
Ruby: ½é¤á¤Æ¤Î Ruby †
Ruby ¤Ç¤Î¥×¥í¥°¥é¥ß¥ó¥°¤Î¤ä¤êÊý¤Ï°Ê²¼¤Î·«¤êÊÖ¤·¤À¡¥
- ruby ¥×¥í¥°¥é¥à¤òÊݸ¤·¤Æ¤ª¤¯¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤ò lec_ruby ¤Ëºî¤ë¡¥
- ¥Æ¥¥¹¥È¥¨¥Ç¥£¥¿¤Ç¤½¤Î¥Õ¥¡¥¤¥ë¤Ë¥×¥í¥°¥é¥à¤ò½ñ¤¹þ¤à(or ½¤Àµ¤¹¤ë)¡¥
¥Æ¥¥¹¥È¥¨¥Ç¥£¥¿¤ò¥â¥Î¤Ë¤·¤Æ¤ª¤«¤Ê¤¤¤È¤³¤³¤Çº¤¤ë¡¥¤³¤ì¤«¤é¤â»÷¤¿¤è¤¦¤Êµ¡²ñ¤Ç¤ä¤Ï¤êº¤¤ë¤è¤Í¡Ä - ruby ¤Ë¤½¤Î¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤òÅϤ¹¤È¡¤ruby ¤¬Æɤ߹þ¤ó¤Ç¼Â¹Ô¤¹¤ë¡¥
- ¤½¤Î·ë²Ì¤Ë°ì´î°ìÍ«¡¥
- 2. ¤ØÌá¤Ã¤Æ·«¤êÊÖ¤·¡¥
¤Þ¤¢¡¤½¬¤¦¤è¤ê´·¤ì¤í¤È¤¤¤¦¤ï¤±¤Ç¡¤°Ê²¼¤ÎÎã¤Ë±è¤Ã¤Æ¤ä¤Ã¤Æ¤ß¤è¤¦¡¥
¼¡¤Î¼ê½ç¤Ë½¾¤Ã¤Æ¡¤¼ÂºÝ¤Ë¤ä¤Ã¤Æ¤ß¤è¤¦.
- ¤Þ¤º¤Ï Ruby ¤ò¸Æ¤Ó½Ð¤·¤ÆÆ°¤¤¤Æ¤â¤é¤¦´Ä¶ ¤ò½àÈ÷¤¹¤ë¡¥
Âç³Ø¤Î PC ¤À¤È¤½¤Î¡Ö´Ä¶¡×¤È¤·¤Æ cygwin ¤¬ »È¤¨¤ë¤Î¤Ç¡¤cygwin ¤òΩ¤Á¾å¤²¤è¤¦(¥á¥Ë¥å¡¼¤ÎÃæ¤òõ¤·¤Æ¤ß¤è¤¦)¡¥ ¹õ¤¯¤Æ»Í³Ñ¤¤ÁǤõ¤¤Ê¤¤²èÌ̤À¤±¤É¡¤¤Ê¤«¤Ê¤«¤É¤¦¤·¤Æ¡¤¤³¤¤¤Ä¤Ï¤¿¤¤¤·¤¿Æ¯¤¼Ô¤Ê¤Î¤À¡¥
¤³¤ì¤ò°ìöΩ¤Á¾å¤²¤¿¤é¡¤¼ø¶È¤¬½ª¤ï¤ë¤Þ¤Ç¤½¤Î¤Þ¤ÞΩ¤Á¾å¤²¤Æ¤ª¤³¤¦¡¥ - cygwin ¤Ë¡¤ruby ÀìÍѥǥ£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤·¤Æ¤â¤é¤ª¤¦¡¥
cygwin ¤Ï¡Ö¤É¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Çºî¶È¤¹¤ë¤Î¤«¡×¤È¤¤¤¦³µÇ°¤ò»ý¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¤¤³¤ì¤ò¾å¤Ç¼«Ê¬¤ÇÍÑ°Õ¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤ËÊѤ¨¤è¤¦¡¥ ¤³¤ì¤Ë¤Ï¡¤cygwin ¤òµ¯Æ°¤·¤Æ½Ð¤Æ¤¤¿¹õ¤¤²èÌ̤Ç
¤È¤¹¤ì¤Ð¤è¤¤(ºî¤Ã¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î̾Á°¤¬lec_ruby¤Î¾ì¹ç¡¥°Ê²¼¡¤Æ±ÍÍ¡¥)¡¥ ¤Á¤Ê¤ß¤Ë¡¤¾å¤Î cd ¤Ï change directory ¤Îά¤Ç¡¤~ ¤Ï¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¤Î¤³¤È¤À¡¥cd ~/lec_ruby
- ¿·µ¬¤Ë¥×¥í¥°¥é¥à¤ò½ñ¤¯¾ì¹ç : ¤½¤Î¥×¥í¥°¥é¥à¤òÆþ¤ì¤Æ¤ª¤¯¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤òºî¤í¤¦¡¥
Î㤨¤Ð test.rb ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤òºî¤ê¤¿¤±¤ì¤Ð¡¤cygwin ¤Ç
¤È¤¹¤ì¤ÐÎɤ¤¡¥touch test.rb
- ¤³¤Î¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤Ë¥×¥í¥°¥é¥à¤ò½ñ¤¹þ¤à¤¿¤á¤Ë¥Æ¥¥¹¥È¥¨¥Ç¥£¥¿¤òΩ¤Á¾å¤²¤è¤¦.
´û¤Ë¼«Ê¬¤Î»È¤¦¥Æ¥¥¹¥È¥¨¥Ç¥£¥¿¤òÁª¤ó¤Ç¤¤¤ë¤Ï¤º¤À¡¥¤½¤ì¤òµ¯Æ°¤·¤è¤¦¡¥
¤¿¤À¤·¡¤Âç³Ø¤Î PC ¤ËÆþ¤Ã¤Æ¤¤¤Ê¤¤¤â¤Î¤òÁª¤ó¤À¿Í¤â¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡¥ ¤½¤¦¤¤¤¦¿Í¤ÏŬÅö¤½¤¦¤Ê¤Î¤òÁª¤Ü¤¦¡¥ - ½é¤á¤Æ¤Î¥×¥í¥°¥é¥à¤ò½ñ¤³¤¦
¥Æ¥¥¹¥È¥¨¥Ç¥£¥¿¤Ç¼¡¤Î¤è¤¦¤Ë°ì¹Ô¤À¤±½ñ¤¤³¤ó¤Ç¡¤Êݸ¤·¤è¤¦.
¤³¤Î¹Ô¤ò¤¤Á¤ó¤È¡Ö²þ¹Ô¡×¤·¤Æ¤ª¤³¤¦! ²þ¹Ô¤·¤Æ¤Ê¤¤¹Ô¤Ïǧ¼±¤µ¤ì¤º¤Ë¥×¥í¥°¥é¥à¤È¤·¤ÆÆɤ߹þ¤Þ¤ì¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡Äp 3+5
- ¥×¥í¥°¥é¥à¤òÆ°¤«¤·¤Æ¤ß¤è¤¦
cygwin ¤ÎÃæ¤Ç¡¤
¤ÈÂǤäƤߤ褦. ¤³¤³¤Þ¤Ç¤Îºî¶È¤ËÌäÂ꤬¤Ê¤±¤ì¤Ðruby -w test.rb
8
¤È¤¤¤¦Åú¤¨¤¬Ê֤äƤ¯¤ë¤Ï¤º¤À¡¥
¤¢¤È¤Ï¡¤¥×¥í¥°¥é¥à¤ò¤É¤ó¤É¤ó²þÎɤ¹¤ë¤¿¤á¤Ë
¡Ö¥Õ¥¡¥¤¥ë¤ÎÃæ¤Î¥×¥í¥°¥é¥à¤ò½ñ¤Ä¾¤·¤ÆÊݸ¡×
¢ª¡Öruby -w ¥Õ¥¡¥¤¥ë̾¡×
¤ò¹¥¤¤Ê¤À¤±·«¤êÊÖ¤»¤Ð¤è¤¤¤À¤±¤À¡¥
Ķ´ÊÁÇ¤Ê Ruby ʸˡ²òÀâ(1) †
¤µ¤Æ¤³¤³¤Ç¡¤ºÇÄã¸ÂɬÍפÊÃμ±¤È¡¤ ³§¤¬´û¤Ë³Ø¤ó¤À³µÇ°¤Ç Ruby ¤ÇÁêÅö¤¹¤ë¥â¥Î¤È¡¤ ÃΤé¤Ê¤«¤Ã¤¿¤±¤ì¤É¤â¤¹¤°¤ï¤«¤ëÃμ± ¤ò½ñ¤¤¤Æ¤ª¤³¤¦¡¥
¤¹¤°Ê¬¤«¤ë¤À¤í¤¦¤±¤ì¤É¤â, Processing ¤ÈÈæ³Ó¤¹¤ë¤È½éÊâ¤Îʸˡ¤Ë´Ø¤·¤Æ¸À¤¨¤Ð¡¤
ºÇÄã¸ÂɬÍפÊÃμ± †
¤â¤¦ÃΤäƤ¤¤ë³µÇ° †
ÃΤé¤Ê¤«¤Ã¤¿¤±¤ì¤É¤â¤¹¤°Ê¬¤«¤ë¤â¤Î †
̾¾Î | ²òÀâ,Ãí°Õ | ¥µ¥ó¥×¥ë |
ÀäÂÐÃÍ | - | a.abs (a ¤ÎÀäÂÐÃÍ) |
ÀÚ¤ê¾å¤² | - | a.ceil (a ¤ÎÀÚ¤ê¾å¤²) |
Âпô | ¼«Á³Âпô | log(a) |
»Ø¿ô | - | exp(a) |
ʸ»ú¿ô | Á´Éô¤Ç²¿Ê¸»ú¡© | s.length |
½¸¹ç¡¤Ê¸»úÎó¤ò¥³¥Ô¡¼ | ½¸¹ç¤Èʸ»úÎó¤À¤±¡¤¥³¥Ô¡¼¤¬Æüì¤À¤è | a = b.dup(a ¤Ë b ¤ÎÃæ¿È¤ò¥³¥Ô¡¼) |
½¸¹ç¤Îºî¤êÊý(1) | Ãæ¿È¤¬´û¤Ë·è¤Þ¤Ã¤Æ¤¤¤ë¤È¤ | a = [1,8,2.3] |
½¸¹ç¤Îºî¤êÊý(2) | Â礤µ¤Ï·è¤Þ¤Ã¤Æ¤¤¤ë¤ó¤À¤±¤É¡Ä¤È¤¤¤¦¤È¤ | a = Array.new(3){0}(3¸Ä¤ÎÍ×ÁǤ¬¤¢¤ë¾ì¹ç¡¥Í×ÁǤϲ¾¤Ë 0 ¤È¤·¤Æ¤¤¤ë) |
½¸¹ç¤Îºî¤êÊý(3) | ¤È¤ê¤¢¤¨¤º¶õ½¸¹ç¤òºî¤ì¤Ð¤¤¤¤¤ä¤È¤¤¤¦¤È¤ | a = [] |
½¸¹ç¤ÎÍ×ÁÇ¿ô | - | group.size |
½¸¹ç¤ËÍ×ÁÇÄɲÃ(ºÇ½é) | - | group.unshift(a)(½¸¹ç¤ÎÀèƬ¤ËÍ×ÁÇ a ¤òÄɲÃ) |
½¸¹ç¤ËÍ×ÁÇÄɲÃ(ºÇ¸å) | - | group.push(a)(½¸¹ç¤ÎºÇ¸åÈø¤ËÍ×ÁÇ a ¤òÄɲÃ) |
½¸¹ç¤ÎÍ×ÁǺï½ü(ºÇ½é) | - | group.shift(½¸¹ç¤ÎÀèƬÍ×ÁǤòºï½ü) |
½¸¹ç¤ÎÍ×ÁǺï½ü(ºÇ¸å) | - | group.pop(½¸¹ç¤ÎºÇ¸åÈø¤òºï½ü) |
ºÇÂç, ºÇ¾®ÃÍ | ½¸¹ç¤ÎÃæ¿È¤ÎºÇÂç, ºÇ¾®ÃÍ | [3,5,2].min ¤Ê¤É |
´Êñ¤Ê¥µ¥ó¥×¥ë: Ê¿¶Ñ †
¼¡¤Î¿ô»ú¤ÎÊ¿¶Ñ¤ò¤È¤Ã¤Æ¤ß¤è¤¦(Åú¤¨¤Ï 1.3 ¤Ë¤Ê¤ë¤Ï¤º¤À).
1.2, -3.0, 3.3, 4.1, 0.9
ÆäËÆñ¤·¤¤¥¢¥ë¥´¥ê¥º¥à¤ä»ÅÁȤߤò¹Í¤¨¤ëɬÍפϤʤ¤¤À¤í¤¦¡¥
¤³¤ì¤À¤±¤Ç¤¢¤ë.
¤³¤Î ruby ¥×¥í¥°¥é¥à¤ò¾å¤Ë¾Ò²ð¤·¤¿µ¡Ç½¤À¤±¤Ç½ñ¤¤¤Æ¤ß¤ë¤È¼¡¤Î¤è¤¦¤Ê¤â¤Î¤Ë¤Ê¤ë¤À¤í¤¦.
¼Â½¬
¾å¤Î¥×¥í¥°¥é¥à¤òÆ°¤«¤·¤Æ¤ß¤è¤¦¡¥
¼Â½¬
¾å¤Î¥×¥í¥°¥é¥à¤òÍý²ò¤·¤è¤¦¡¥
¤ª¤½¤é¤¯¡¤¡ÖÁ´Éô¤¹¡×¤È¤³¤í¤¬½é³Ø¼Ô¤Ë¤ÏÆñ¤·¤«¤Ã¤¿¤ê¤¹¤ë¤À¤í¤¦.
¤Ñ¤Ã¤È¤ï¤«¤é¤Ê¤¯¤Æ¤â¤è¤¤¤«¤é¡¤¾å¤Î¥µ¥ó¥×¥ë¤ò¤¸¤Ã¤¯¤êÆɤó¤Ç
Îý½¬ÌäÂê †
ʬ»¶¤ò·×»»¤¹¤ë¥×¥í¥°¥é¥à¤ò½ñ¤¤¤ÆÆ°¤«¤½¤¦¡¥
¼¡¤Î¿ô»ú¤Îʬ»¶¤ò¤È¤Ã¤Æ¤ß¤è¤¦(Åú¤¨¤Ï 6.1 ¤Ë¤Ê¤ë¤Ï¤º¤À).
1.2, -3.0, 3.3, 4.1, 0.9
Îý½¬ÌäÂê †
¤ß¤ó¤Ê¤¬µ¤¤Ë¤Ê¤ë¡¤Êк¹Ãͤò·×»»¤¹¤ë¥×¥í¥°¥é¥à¤ò½ñ¤¤¤ÆÆ°¤«¤½¤¦¡¥
Á´³ØÀ¸10¿Í¤ÎÅÀ¿ô¤¬¼¡¤Î¤è¤¦¤Ê¾ì¹ç¡¤¤½¤ì¤¾¤ì¤ÎÊк¹Ãͤò·×»»¤·¤Æ¤ß¤è¤¦(Êк¹ÃͤÎÄêµÁ¤òÃΤé¤Ê¤¤¿Í¤Ï¸¡º÷¤·¤è¤¦¡¥ÆüËÜÆÈÆäγµÇ°¤À¤Í)¡¥
72, 30, 23, 41, 9, 55, 18, 80, 15, 2
¥ì¥Ý¡¼¥È †
°Ê²¼¤Î²ÝÂê¤Ë¤Ä¤¤¤Æ¡¤¤¢¤¿¤¦¤«¤®¤ê¸ÌÀ¤ÊÄ´ºº¤È¹Í»¡¤È¼Â¹Ô¤ò¤·¡¤
ExpMath1-Report-09
¤È¤¤¤¦Âê̾¤ò¤Ä¤±¤Æ e-mail ¤Ë¤Æ¶µ´±¤Ë¥ì¥Ý¡¼¥È¤È¤·¤ÆÄó½Ð¤»¤è¡¥¤Ê¤ª¡¤³Æ¼«¤Î
- ½ê°(³ØÉô¡¤³Ø²Ê)
- ³ØÀÒÈÖ¹æ
- ³Øǯ
- »á̾
¤ò½ñ¤¯¤Î¤ò˺¤ì¤Ê¤¤¤è¤¦¤Ë.
¼«Ê¬¤Î¥ì¥Ý¡¼¥ÈºîÀ®¥Ä¡¼¥ë¥»¥Ã¥È¤òµºÜ¤»¤è(¤â¤Á¤í¤ó¡¤º£²ó¤Î¥ì¥Ý¡¼¥È¤â¤½¤Î¥Ä¡¼¥ë¥»¥Ã¥È¤ò»È¤Ã¤ÆºîÀ®¤¹¤ë¤³¤È)¡¥
¥ì¥Ý¡¼¥È²ÝÂê †
- ¼Â½¬¤Ç½Ð¤Æ¤¤¿Îý½¬ÌäÂê¤ËÂФ·¤Æ¤Î¡¤¼«Ê¬¤Î²òÅú¥×¥í¥°¥é¥à¤È¡¤¤½¤Î·ë²Ì¤ò¼¨¤»¡¥
- 1. ¤Î¥×¥í¥°¥é¥à¤ò¡Ö¾ÜºÙ¤Ë¡×²òÀ⤻¤è¡¥
about Icons, ClipArts †
For details, see this.