You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Simon H. <sim...@us...> - 2010-11-09 16:51:46
|
Update of /cvsroot/stack/stack-dev/lib In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib Modified Files: Tag: item_state_separation stringUtil.php AimConverter.php error.php Log Message: Brought back up to date with big HEAD merge. Index: error.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/error.php,v retrieving revision 1.21 retrieving revision 1.21.8.1 diff -C2 -d -r1.21 -r1.21.8.1 *** error.php 27 Aug 2009 16:23:00 -0000 1.21 --- error.php 9 Nov 2010 16:51:38 -0000 1.21.8.1 *************** *** 18,23 **** */ /** ! Error class ! Class for indicating and defining errors */ global $config; --- 18,23 ---- */ /** ! * Error class ! * Class for indicating and defining errors */ global $config; *************** *** 30,34 **** private $fail; //bool if error has occured, should the program fail? private $userError; //array of errors for display to the user. format key=>errormessage ! private $logger; function __construct($fail=false) --- 30,34 ---- private $fail; //bool if error has occured, should the program fail? private $userError; //array of errors for display to the user. format key=>errormessage ! //private static $logger; function __construct($fail=false) *************** *** 37,41 **** $this->status = false; //no error yet $this->userError = array(); ! $this->logger = new Logger('ErrorLog'); } --- 37,41 ---- $this->status = false; //no error yet $this->userError = array(); ! //$this->logger = new Logger('ErrorLog'); } Index: AimConverter.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/AimConverter.php,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -C2 -d -r1.6 -r1.6.8.1 *** AimConverter.php 11 Sep 2009 08:43:55 -0000 1.6 --- AimConverter.php 9 Nov 2010 16:51:38 -0000 1.6.8.1 *************** *** 167,171 **** case "h": case "hide": ! $questionVariables .= "$text\n"; break; --- 167,184 ---- case "h": case "hide": ! // convert rand function ! $rand_pattern = '/:=rand\((-?\d+)\.\.(-?\d+)\)/'; ! preg_match($rand_pattern, $text, $matches); ! $lower = $matches[1]; ! $upper = $matches[2]; ! /* $questionVariables .= 'rand('.($upper-$lower).')'; // range ! if($lower != 0) { ! if($matches[1] > 0) echo '+'; ! echo $matches[1]; ! }*/ ! $text = preg_replace('/rand\('.$lower.'..'.$upper.'\)/', "rand_with_step($lower, $upper, 1)", $text); ! // change assignment operator ! $text = str_replace(':=', '=', $text); ! $questionVariables .= $text."\n"; break; Index: stringUtil.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/stringUtil.php,v retrieving revision 1.19.6.5 retrieving revision 1.19.6.5.2.1 diff -C2 -d -r1.19.6.5 -r1.19.6.5.2.1 *** stringUtil.php 5 Nov 2009 10:39:38 -0000 1.19.6.5 --- stringUtil.php 9 Nov 2010 16:51:38 -0000 1.19.6.5.2.1 *************** *** 584,587 **** --- 584,616 ---- return $array; } + + /** + * Returns a more intuitive datestamp + */ + public static function prettifyDate($datestamp) { + /* + * Rules: + * show time if this week + * show day + month if this year + * show month + year if not this year + */ + + $dayStart = strtotime("00:00"); + $monthAgo = strtotime('-1 month'); + $yearAgo = strtotime('-1 year'); + + //echo "yearstart: $yearStart monthStart: $monthStart dayStart: $dayStart"; + + $time = strtotime($datestamp); + + if($time >= $dayStart) return date("g:ia", $time);// today + if($time > $monthAgo) return date("g:ia, j M", $time);// not today + if($time > $yearAgo) return date("M Y", $time); // not this year + if($time > $yearAgo) return date("j M", $time); // not this month + + + // failed to prettify somehow + return $datestamp; + } } |
From: Simon H. <sim...@us...> - 2010-11-09 16:51:46
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/stack_diagnostic/images In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/opaque/moodleModule/stack_diagnostic/images Added Files: Tag: item_state_separation readme.html readme.txt warning.png Log Message: Brought back up to date with big HEAD merge. --- NEW FILE: warning.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: readme.html --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- Document HEAD --> <head> <title>famfamfam.com: Silk Icons</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="mssmarttagspreventparsing" content="true" /> <meta name="robots" content="all" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="author" content="Mark James" /> <meta name="copyright" content="Mark James" /> <meta name="revisit-after" content="7 days" /> <style type="text/css"> [...1456 lines suppressed...] <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr></table> </p> </div><!-- /content_inner --> <!-- A break! --> <br class="clear" /> </div><!-- /content_outer --> </div><!-- /container_inner --> </div><!-- /container_outer --> </body> </html> --- NEW FILE: readme.txt --- Silk icon set 1.3 _________________________________________ Mark James http://www.famfamfam.com/lab/icons/silk/ _________________________________________ This work is licensed under a Creative Commons Attribution 2.5 License. [ http://creativecommons.org/licenses/by/2.5/ ] This means you may use it for any purpose, and make any changes you like. All I ask is that you include a link back to this page in your credits. Are you using this icon set? Send me an email (including a link or picture if available) to mj...@gm... Any other questions about this icon set please contact mj...@gm... |
From: Simon H. <sim...@us...> - 2010-11-09 16:51:46
|
Update of /cvsroot/stack/stack-dev/lib/XML In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/XML Modified Files: Tag: item_state_separation ExportStackTwoItem.php ExportStackTwoBatch.php ImportStackOneItem.php ImportStackTwoItem.php Log Message: Brought back up to date with big HEAD merge. Index: ExportStackTwoItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/XML/ExportStackTwoItem.php,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** ExportStackTwoItem.php 27 Aug 2009 16:23:00 -0000 1.11 --- ExportStackTwoItem.php 9 Nov 2010 16:51:38 -0000 1.11.8.1 *************** *** 208,212 **** { $node = $this->dom->createElement($title); ! $nodeText = $this->dom->createTextNode($text); $node->appendChild($nodeText); return $node; --- 208,212 ---- { $node = $this->dom->createElement($title); ! $nodeText = $this->dom->createTextNode(utf8_encode($text)); $node->appendChild($nodeText); return $node; Index: ImportStackTwoItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/XML/ImportStackTwoItem.php,v retrieving revision 1.23 retrieving revision 1.23.8.1 diff -C2 -d -r1.23 -r1.23.8.1 *** ImportStackTwoItem.php 16 Oct 2009 10:28:43 -0000 1.23 --- ImportStackTwoItem.php 9 Nov 2010 16:51:38 -0000 1.23.8.1 *************** *** 93,97 **** public function importQuestion($filename=NULL, $itemOptions=NULL, $validate=true) { - //echo $filename; if($filename != NULL) { --- 93,96 ---- Index: ImportStackOneItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/XML/ImportStackOneItem.php,v retrieving revision 1.25 retrieving revision 1.25.8.1 diff -C2 -d -r1.25 -r1.25.8.1 *** ImportStackOneItem.php 27 Aug 2009 16:23:00 -0000 1.25 --- ImportStackOneItem.php 9 Nov 2010 16:51:38 -0000 1.25.8.1 *************** *** 109,113 **** if($valid == true) { - //echo 'Correct'; $this->setDesc(); $this->setVars(); --- 109,112 ---- Index: ExportStackTwoBatch.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/XML/ExportStackTwoBatch.php,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** ExportStackTwoBatch.php 27 Aug 2009 16:23:00 -0000 1.5 --- ExportStackTwoBatch.php 9 Nov 2010 16:51:38 -0000 1.5.8.1 *************** *** 82,90 **** $path = $config->get('tmp'); ! if($filename == NULL) ! { ! $title = get_string('stackExport_xmlFilename', 'stack', ''); ! } ! $title = $title.'.xml'; $this->title = $title; --- 82,87 ---- $path = $config->get('tmp'); ! $title = get_string('stackExport_xmlFilename', 'stack', ''); ! $title = $title.date('_Y_m_d_H-i-s',time()).'.xml'; $this->title = $title; |
Update of /cvsroot/stack/stack-dev/sample_questions/oer In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/sample_questions/oer Added Files: Tag: item_state_separation licence.txt CR_Diff_09_misc.xml CR_Diff_03_higher.xml CR_Diff_01_basic.xml CR_Int_14_substitution.xml CR_Diff_06_chain.xml CR_Int_12_definite.xml CR_Diff_02_linearity.xml CR_Diff_04_product.xml CR_Int_11_linearity.xml CR_Int_17_misc.xml CR_Diff_07_implicit.xml CR_Diff_08_parametrical.xml CR_Int_16_trigonometric.xml CR_Int_13_parts.xml AlgMap.xml CR_Diff_05_quotient.xml CR_Int_15_partialfrac.xml Barnard.tex readme.txt CR_Int_10_basic.xml CR_all.xml Log Message: Brought back up to date with big HEAD merge. --- NEW FILE: licence.txt --- License THIS WORK IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. 1. Definitions a."Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. b."Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined below) for the purposes of this License. c."Creative Commons Compatible License" means a license that is listed at http://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License. d."Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership. e."License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike. f."Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. g."Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. h."Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. i."You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. j."Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. k."Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. 2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. 3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: a.to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; b.to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified."; c.to Distribute and Publicly Perform the Work including as incorporated in Collections; and, d.to Distribute and Publicly Perform Adaptations. e.For the avoidance of doubt: i.Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; ii.Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and, iii.Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License. The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved. 4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: a.You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested. b.You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible License. If you license the Adaptation under one of the licenses mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you must comply with the terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License; (III) You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License. c.If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. d.Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise. 5. Representations, Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. Termination a.This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. b.Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. 8. Miscellaneous a.Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. b.Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. c.If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. d.No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. e.This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. f.The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. --- NEW FILE: readme.txt --- This folder contains STACK questions which are released as Open Educational Resources. ==Licence== These materials are released under the Creative Commons Attribution-Share Alike 3.0 Unported http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/legalcode Chris Sangwin, 5 November 2009 University of Birmingham ==Background== Each of these questions should have * randomly generated versions * full worked solution ==AlgMap: Algebra questions== These are approximately 140 questions in algebra, taken from A Pocket Map of Algebraic Manipulation, by Dr Tony Barnard, Department of Mathematics. King's College London. They are designed to demonstrate many of the major problems in elementary algebra. The LaTeX source file of this "Map" is also included as Barnard.tex ==CR: Calculus refresher.== These are approximately 215 questions in calculus. They are inspired by, with permission, the questions in the Calculus Refresher http://www.mathcentre.ac.uk/resources.php/1 CR_all is a single file with all questions, but this might be difficult to upload. The following files have questions grouped by topic. CR_Diff_01_basic Derivatives of basic functions CR_Diff_02_linearity Linearity in differentiation CR_Diff_03_higher Higher derivatives CR_Diff_04_product The product rule for differentiation CR_Diff_06_chain The chain rule for differentiation CR_Diff_07_implicit Differentiation of functions defined implicitly CR_Diff_08_parametrical Differentiation of functions defined perimetrically CR_Diff_09_misc Miscellaneous differentiation exercises CR_Int_10_basic Integrals of basic functions CR_Int_11_linearity Linearity in integration CR_Int_12_definite Evaluating definite integrals CR_Int_13_parts Integration by parts CR_Int_14_substitution Integration by substitution CR_Int_15_partialfrac Integration using partial fractions CR_Int_16_trigonometric Integration using trigonometrical identities CR_Int_17_misc Miscellaneous integration exercises ===Acknowledgements=== The work on the calculus refresher has been made possible, in part, by support from the FETLAR Project. http://www.fetlar.bham.ac.uk/ The FETLAR project is the MSOR community's bid through the Subject Centre strand for the Open Educational Resources (OER) call from HEFCE/JISC. http://www.jisc.ac.uk/fundingopportunities/funding_calls/2008/12/grant1408.aspx == AlgMap == These questions are based on Tony Barnard's "Map of Algebraic Manipulation". --- NEW FILE: CR_Diff_09_misc.xml --- <?xml version="1.0" encoding="UTF-8"?> <mathQuiz version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find the following derivative: \[ \frac{d}{d@v@}\left[ @p@\right]. \] #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>v = x; rdm1 = 2+rand(4); rdm2 = 2+rand(5); rdm3 = 2+rand(5); ppp1 = sin(rdm1*v); ppp2 = cos(rdm2*v); pp1 = ppp1*ppp2; pp2 = tan(rdm3*v); p = pp1/pp2</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>To solve this problem you will need to use the product rule <hint>calc_product_rule</hint> and the quotient rule<hint>calc_quotient_rule</hint>. Let $f(@v@)=@pp1@$ and $g(@v@)=@pp2@$. Then, \[\frac{d}{d@v@}\left[@p@\right] = \frac{\frac{df}{d@v@}\cdot g - f\cdot \frac{dg}{d@v@}}{g^2}.\] In order to calculate $\frac{df}{d@v@}$ you need to use the product rule, by defining two new functions: $h(@v@)=@ppp1@$ and $i(@v@)=@ppp2@$ so that $f(@v@)=h(@v@)i(@v@)$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@pp1@] &\displaystyle =&\displaystyle \frac{dh}{dx}\cdot i + h\cdot \frac{di}{dx}\\ &\displaystyle =&\displaystyle [@diff(ppp1,v)@]@ppp2@ + @ppp1@[@diff(ppp2,v)@] \\ &\displaystyle =&\displaystyle @diff(ppp1,v)*ppp2@ + @ppp1*diff(ppp2,v)@ \\ &\displaystyle =&\displaystyle @diff(pp1,v)@ \end{array}\] Hence, \[\begin{array}{rcl}\displaystyle \frac{d}{dx}\left[@p@\right] &\displaystyle =&\displaystyle \frac{\frac{df}{d@v@}\cdot g - f\cdot \frac{dg}{d@v@}}{g^2} \\ &\displaystyle =&\displaystyle \frac{[@diff(pp1,v)@]@pp2@ - @pp1@[@diff(pp2,v)@]}{[@pp2@]^2} \\ &\displaystyle =&\displaystyle \frac{@diff(pp1,v)*pp2@ - @pp1*diff(pp2,v)@}{@pp2^2@} \\ &\displaystyle =&\displaystyle @factor(diff(p,v))@ \end{array}\] </castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>\[\frac{d}{d@v@}(@p@) = @diff(p,v)@ \]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>factor(diff(p,v))</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>q = pp2/pp1</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Diff</answerTest><teachersAns>factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions>v</testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>-factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have lost the minus sign as your answer is the negative of what was expected.</feedback><ansnote>Result-1-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-1-F </ansnote><nextPR>2</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>factor(diff(q,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have differentiated @q@ instead of the other way up!</feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-2-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>CR-Diff-09-misc-2.c</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Miscellaneous differentiation exercises</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://stack.bham.ac.uk/new-stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-18 18:40:53</selection><default>2009-10-20 11:47:02</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Published</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>Differentiation, CR, Miscellaneous</selection><default>Differentiation, CR, Miscellaneous</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect'>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>-factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-1-T </value></col></test><test><col><key>IE_ans1</key><value>factor(diff(pp2/pp1,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-T </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find the following derivative: \[ \frac{d}{d@v@}\left[\left(@pp@\right)^{@rdm2@}\right]. \] #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>v = x; rdm1 = 2+rand(7); rdm2 = (2+2*rand(5))/(3+2*rand(5)); ppp1 = 1-v^rdm1; ppp2 = 1+v^rdm1; pp = ppp1/ppp2; p = pp^(rdm2)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>To solve this problem you will need to use the chain rule <hint>calc_chain_rule</hint> and the quotient rule <hint>calc_quotient_rule</hint>. Let \[f(@v@)=@p@\] and \[g(@v@)=@pp@.\] Then $f(@v@)=[g(@v@)]^{@rdm2@}$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}\left[@p@\right] &\displaystyle =&\displaystyle \frac{df}{dg}\cdot \frac{dg}{dx} \\ &\displaystyle =&\displaystyle \frac{d}{dg}[g^{@rdm2@}]\cdot \frac{d}{d@v@}[g] \end{array}\] In order to find $\frac{dg}{d@v@}$ you have to define two new functions: $h(@v@)=@ppp1@$ and $i(@v@)=@ppp2@$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}(g) &\displaystyle =&\displaystyle \frac{d}{d@v@}\left[@pp@\right] \\ &\displaystyle =&\displaystyle \frac{d}{d@v@}\left(\frac{h}{i}\right) \\ &\displaystyle =&\displaystyle \frac{\frac{dh}{d@v@}\cdot i - h\cdot \frac{di}{d@v@}}{i^2} \\ &\displaystyle =&\displaystyle \frac{\left[\frac{d}{d@v@}(@ppp1@)\right]\cdot (@ppp2@) - (@ppp1@)\cdot \left[\frac{d}{d@v@}(@ppp2@)\right]}{(@ppp2@)^2} \\ &\displaystyle =&\displaystyle \frac{[@diff(ppp1,v)@]\cdot (@ppp2@) - (@ppp1@)\cdot [@diff(ppp2,v)@]}{@ppp2^2@} \\ &\displaystyle =&\displaystyle \frac{@factor(diff(ppp1,v)*ppp2-ppp1*diff(ppp2,v))@}{@ppp2^2@}. \end{array}\] Now, \[\begin{array}{rcl}\displaystyle \frac{d}{dg}[g^{@rdm2@}] &\displaystyle =&\displaystyle @rdm2@g^@rdm2-1@ \\ &\displaystyle =&\displaystyle @rdm2*pp^(rdm2-1)@ \end{array}\] Hence, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}\left[@p@\right] &\displaystyle =&\displaystyle \frac{d}{dg}[g^{@rdm2@}]\cdot \frac{d}{d@v@}[g] \\ &\displaystyle =&\displaystyle \frac{@factor(diff(ppp1,v)*ppp2-ppp1*diff(ppp2,v))@}{@ppp2^2@}\cdot @rdm2*pp^(rdm2-1)@ \\ &\displaystyle =&\displaystyle @factor(diff(p,v))@ \end{array}\] </castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>\[\frac{d}{d@v@}(@p@) = @diff(p,v)@ \]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>factor(diff(p,v))</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>q = (ppp2/ppp1)^(rdm2)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Diff</answerTest><teachersAns>factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions>v</testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>-factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have lost the minus sign as your answer is the negative of what was expected. </feedback><ansnote>Result-1-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-1-F </ansnote><nextPR>2</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>factor(diff(p,v))/diff(pp,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You need to use the chain rule <hint>calc_chain_rule</hint> as \[@p@\] is a function of @v@.</feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-2-F </ansnote><nextPR>3</nextPR></false><teacherNote></teacherNote></PR><PR id="3"><answerTest>AlgEquiv</answerTest><teachersAns>factor(diff(q,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have differentiated \[@q@\] instead of the other way up.</feedback><ansnote>Result-3-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-3-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>CR-Diff-09-misc-3.c</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Miscellaneous differentiation exercises</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://stack.bham.ac.uk/new-stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-18 18:57:02</selection><default>2009-10-20 11:47:15</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Published</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>Differentiation, CR, Miscellaneous</selection><default>Differentiation, CR, Miscellaneous</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect'>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>-factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-1-T </value></col></test><test><col><key>IE_ans1</key><value>factor(diff(p,v))/diff(pp,v)</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-T </value></col></test><test><col><key>IE_ans1</key><value>factor(diff((ppp2/ppp1)^(rdm2),v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-3-T </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find the following derivative: \[ \frac{d}{d@v@}[@p@]. \] #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>v = x; rdm1 = 2+rand(2); rdm2 = 1/(2+rand(5)); ppp = v-v^rdm1; pp = ppp^rdm2; p = exp(pp)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>To solve this question, you will have to use the chain rule <hint>calc_chain_rule</hint> more than once. Let $f(@v@)=@p@$ and $g(@v@)=@pp@$. Then, $f(@v@)=e^{(g(@v@))}$ \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@p@] &\displaystyle =&\displaystyle \frac{df}{dg}\cdot \frac{dg}{dx} \\ &\displaystyle =&\displaystyle \frac{d}{dg}(e^{g})\cdot \frac{d}{dx}[@pp@] \end{array}\] To find \[\frac{d}{dx}[@pp@]\] you have to define a new function: $h(@v@)=@ppp@$, so that $g(@v@)=h^{@rdm2@}$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@pp@] &\displaystyle =&\displaystyle \frac{dg}{dh}\cdot \frac{dh}{d@v@} \\ &\displaystyle =&\displaystyle \frac{d}{dh}(h^{@rdm2@})\cdot \frac{d}{d@v@}(@ppp@) \\ &\displaystyle =&\displaystyle @rdm2@h^{@rdm2-1@}\cdot (@diff(ppp,v)@) \\ &\displaystyle =&\displaystyle @diff(pp,v)@ \end{array}\] So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@p@] &\displaystyle =&\displaystyle \frac{d}{dg}(e^{g})\cdot \frac{d}{dx}[@pp@] \\ &\displaystyle =&\displaystyle e^g \cdot @diff(pp,v)@ \\ &\displaystyle =&\displaystyle e^{@pp@}@diff(pp,v)@ \\ &\displaystyle =&\displaystyle @diff(p,v)@ \end{array}\] </castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>\[\frac{d}{d@v@}(@p@) = @diff(p,v)@ \]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>diff(p,v)</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>q3 = v+v^rdm1; q2 = q3^rdm2; q = exp(q2)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Diff</answerTest><teachersAns>diff(p,v)</teachersAns><studentAns>ans1</studentAns><testoptions>v</testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>-diff(p,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have lost the minus sign as your answer is the negative of what was expected.</feedback><ansnote>Result-1-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-1-F </ansnote><nextPR>2</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>diff(q,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have differentiated @ppp@ incorrectly - there is a sign wrong.</feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-2-F </ansnote><nextPR>3</nextPR></false><teacherNote></teacherNote></PR><PR id="3"><answerTest>AlgEquiv</answerTest><teachersAns>diff(p,v)/diff(pp,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You need to use the chain rule <hint>calc_chain_rule</hint> to differentiate @p@ with respect to @v@.</feedback><ansnote>Result-3-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-3-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>CR-Diff-09-misc-4.b</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Miscellaneous differentiation exercises</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></s... [truncated message content] |
From: Chris S. <san...@us...> - 2010-11-09 14:50:50
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2596/maxima Modified Files: Tag: grobner stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84.2.1 retrieving revision 1.84.2.2 diff -C2 -d -r1.84.2.1 -r1.84.2.2 *** stackmaxima.mac 9 Nov 2010 13:39:39 -0000 1.84.2.1 --- stackmaxima.mac 9 Nov 2010 14:50:41 -0000 1.84.2.2 *************** *** 51,57 **** stack_reset(1000); - alias(int,integrate); /* Allows integrate to be called with int() */ - alias(ln,log); alias(simplify,fullratsimp); /* Allows simplify to be something */ --- 51,55 ---- *************** *** 62,65 **** --- 60,72 ---- /* ********************************** */ + /* Logarithms */ + /* ********************************** */ + alias(ln,log); + load("log10"); + texput(log10,"\\log\\mathrm{10}",prefix); + alias(lg,log10); + texput(lg,"\\mathrm{lg}",prefix); + + /* ********************************** */ /* Load contributed packages */ /* ********************************** */ *************** *** 238,247 **** ); ! /* ******************************************* */ ! /* A return object string */ ! /* */ ! /* rawmk should be a float/int between 0 and 1 */ ! /* amswernote, is for teacher stats */ ! /* ******************************************* */ StackReturnOb(rawmk,ansnote,fb):=block([str], --- 245,254 ---- ); ! /* ********************************************* */ ! /* A return object string */ ! /* */ ! /* rawmark should be a float/int between 0 and 1 */ ! /* answernote, is for teacher stats */ ! /* ********************************************* */ StackReturnOb(rawmk,ansnote,fb):=block([str], *************** *** 260,263 **** --- 267,272 ---- exs:errcatch(ev(expr,simp)), if exs=[] then return(false), + if length(expr)#1 then print(StackAddFeedback("","CommaError",string(expr),string(setify(expr)))), + expr:first(expr), /* Check for floats, and if there are any then throw an error */ if ForbidFloats and anyfloatex(expr) then *************** *** 276,293 **** )$ ! /*JPH validate an expression without type checking. Floats and mathematical errors only. */ ! stack_validate_typeless(ex,ForbidFloats,LowestTerms) := block( [simp:false,exs], /* Try to simply the expression to catch CAS errors */ ! exs:errcatch(ev(ex,simp)), if exs=[] then return(false), /* Check for floats, and if there are any then throw an error */ ! if ForbidFloats and anyfloatex(ex) then print(StackAddFeedback("","Illegal_floats")), /* Checks fractions are in lowest terms */ ! if LowestTerms and all_lowest_termsex(ex)=false then print(StackAddFeedback("","Lowest_Terms")), /* Now display the result */ simp:false, ! return(ex) )$ --- 285,304 ---- )$ ! /*validate an expression without type checking. Floats and mathematical errors only. */ ! stack_validate_typeless(expr,ForbidFloats,LowestTerms) := block( [simp:false,exs], /* Try to simply the expression to catch CAS errors */ ! exs:errcatch(ev(expr,simp)), if exs=[] then return(false), + if length(expr)#1 then print(StackAddFeedback("","CommaError",expr,setify(expr))), + expr:first(expr), /* Check for floats, and if there are any then throw an error */ ! if ForbidFloats and anyfloatex(expr) then print(StackAddFeedback("","Illegal_floats")), /* Checks fractions are in lowest terms */ ! if LowestTerms and all_lowest_termsex(expr)=false then print(StackAddFeedback("","Lowest_Terms")), /* Now display the result */ simp:false, ! return(expr) )$ *************** *** 389,397 **** /* ********************************** */ - if is(MAXIMA_VERSION_NUM <= 5.12) then block( - round(x) := ?round(x), - truncate(x) := ?truncate(x) - ); - /* numberp() does not "work" when simp:false, since unary minus is an unevaluated function... */ simp_numberp(ex) := block( --- 400,403 ---- *************** *** 416,433 **** )$ - - stack_matrix_size(m) := block( - mLength : length(m), - if(mLength > 0) then mWidth : length(m[1]) - else mWidth : 0, - - ret : [mLength, mWidth], - return(ret))$ - - if is(MAXIMA_VERSION_NUM <= 5.11) then block( - matrix_size(x) := stack_matrix_size(x) - ); /* MAXMA >= 5.12 includes matrix_size function. JPH 10-12-07 */ - - decimalplaces(x,n) := block([simp:true,fpprintprec],fpprintprec:n,float(round(10^n*float(x))/(10^n)))$ --- 422,425 ---- *************** *** 486,490 **** ); ! /* commonfac(l) returns the hcf of a list of numbers */ commonfaclist(l) := block([i,a,ret], if listp(l) then --- 478,482 ---- ); ! /* commonfac(l) returns the gcd of a list of numbers */ commonfaclist(l) := block([i,a,ret], if listp(l) then *************** *** 516,529 **** )$ - /* Old code 25/9/9 - ex1:part(ex,1), - ex2:part(ex,2), - ex1:ev(setify(factorlist(ex1)),simp), - ex2:ev(setify(factorlist(ex2)),simp), - ex3:intersect(ex1,ex2), - if ex3={} then return(true), - return(false) - */ - /* Create a list with all parts for which numberp(ex)=true */ list_expression_numbers(ex) := block([ex2], --- 508,511 ---- *************** *** 590,593 **** --- 572,592 ---- )$ + /* ********************************** */ + /* Parts of expressions */ + /* ********************************** */ + + /* op(ex) is unsafe on atoms: this is a fix. */ + /* This function always returns a string */ + stack_op(ex) := block( + if atom(ex) then return(""), + if op(ex)#"-" then + if stringp(op(ex)) then return(op(ex)) else return(string(op(ex))) + else + if atom(first(ex)) then + return("") + else + if stringp(op(first(ex))) then return(op((first(ex)))) else return(string(op(ex))) + )$ + /* This function takes an expression ex and returns a list of coefficients of v */ coeff_list(ex,v):= block([deg,kloop,cl], *************** *** 629,645 **** )$ - /* Reduces an inequality to either ? > 0 or ? >=0 */ - ineqreduce(ex) := block([op2,ex2], - if atom(ex) then return(ex), - if op(ex)="=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) = 0), - if op(ex)=">" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) > 0), - if op(ex)=">=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) >= 0), - if op(ex)="<" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) > 0), - if op(ex)="<=" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) >= 0), - ex2:args(ex), - ex2:map(ineqreduce,ex2), - return(apply(op(ex),ex2)) - )$ - expressionp(ex) := block( if matrixp(ex) or listp(ex) or equationp(ex) or inequalityp(ex) or setp(ex) then --- 628,631 ---- *************** *** 769,773 **** /* Otherwise we have two expressions*/ if Stack_Test(SA,SB) then ! RawMark:1, ret:[true,RawMark,AnswerNote,FeedBack], return(ret) --- 755,761 ---- /* Otherwise we have two expressions*/ if Stack_Test(SA,SB) then ! RawMark:1 ! else if Stack_Test(exdowncase(SA),exdowncase(SB)) then ! AnswerNote:"ATAlgEquiv WrongCase ", ret:[true,RawMark,AnswerNote,FeedBack], return(ret) *************** *** 777,781 **** ATList(SA,SB):= block([AddFeedBack,SAN,SAl,SBl,ret,retnew,k], ! /* Get sizes of matrices */ SAN : SA, SAl : length(SA), --- 765,769 ---- ATList(SA,SB):= block([AddFeedBack,SAN,SAl,SBl,ret,retnew,k], ! /* Get sizes of lists */ SAN : SA, SAl : length(SA), *************** *** 787,791 **** ret:[true,1,"",""], AddFeedBack:false, ! for k:1 thru SAl do block( retnew:ATAlgEquivfun(SA[k],SB[k]), ret[1]:ret[1] and retnew[1], --- 775,779 ---- ret:[true,1,"",""], AddFeedBack:false, ! for k:1 thru SAl do block([retnew], retnew:ATAlgEquivfun(SA[k],SB[k]), ret[1]:ret[1] and retnew[1], *************** *** 805,816 **** )$ /* Two equations are the "same" when they have identical roots with identical multiplicities */ ATEquation(SA,SB):= block([RawMark,SA1,SB1,SB2], RawMark:0, ! SA1:fullratsimp(trigexpand(rhs(SA)-lhs(SA))), ! SB1:fullratsimp(trigexpand(rhs(SB)-lhs(SB))), ! SA1:SA1*denom(SA1), ! SB1:SB1*denom(SB1), if SA1#0 then /* We need a slight hack to turn %i+1 into a number */ --- 793,842 ---- )$ + /* Equations */ + stack_eqnprepare(ex):=block([ret], + ret:fullratsimp(trigexpand(rhs(ex)-lhs(ex))), + ret:ret*denom(ret), + return(expand(ret)) + )$ + + stack_eqncompare(SA,SB,sl):=block([ret,G0,G1], + G0 :poly_buchberger(SA,sl), + G1 :poly_buchberger(SB,sl), + ret:poly_grobner_equal(G0,G1,sl), + return(ret) + )$ + + stack_assignmentp(ex):=block( + if atom(ex) then return(false) + else if op(ex)#"=" then return(false) + else if atom(lhs(ex)) and not(real_numberp(lhs(ex))) and real_numberp(rhs(ex)) then return(true) + else return(false) + )$ + + stack_assignmentrev(ex):=block( + if atom(ex) then return(ex) + else if op(ex)#"=" then return(ex) + else if real_numberp(lhs(ex)) and not(real_numberp(rhs(ex))) then return(rhs(ex)=lhs(ex)) + else return(ex) + )$ + + /* Take a list of equations, and re-evaluate it in the context of any assignments of the form d=10 + This is needed in practice with systems of equations, as students may write [d=10, d=v*t] */ + stack_eval_assignments(ex):= block([asl,sl], + if not(listp(ex)) then return(ex), + sl:maplist(stack_assignmentrev,ex), + asl:filter(stack_assignmentp,sl), + if not(emptyp(asl)) then + (sl:listify(setdifference(setify(sl),setify(asl))), + sl:ev(sl,asl)), + return(sl) + )$ + /* Two equations are the "same" when they have identical roots with identical multiplicities */ ATEquation(SA,SB):= block([RawMark,SA1,SB1,SB2], RawMark:0, ! SA1:stack_eqnprepare(SA), ! SB1:stack_eqnprepare(SB), if SA1#0 then /* We need a slight hack to turn %i+1 into a number */ *************** *** 821,829 **** )$ ATInequality(SA,SB):= block([RawMark,FeedBack,AnswerNote,SA1,SB1,samex], RawMark:0, FeedBack:"", AnswerNote:"", ! SA:ineqreduce(SA), ! SB:ineqreduce(SB), SA1:ev(part(SA,1),simp), SB1:ev(part(SB,1),simp), --- 847,869 ---- )$ + /* Reduces an inequality to either ? > 0 or ? >=0 */ + stack_ineqprepare(ex) := block([op2,ex2], + if atom(ex) then return(ex), + if op(ex)="=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) = 0), + if op(ex)=">" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) > 0), + if op(ex)=">=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) >= 0), + if op(ex)="<" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) > 0), + if op(ex)="<=" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) >= 0), + ex2:args(ex), + ex2:map(stack_ineqprepare,ex2), + return(apply(op(ex),ex2)) + )$ + + ATInequality(SA,SB):= block([RawMark,FeedBack,AnswerNote,SA1,SB1,samex], RawMark:0, FeedBack:"", AnswerNote:"", ! SA:stack_ineqprepare(SA), ! SB:stack_ineqprepare(SB), SA1:ev(part(SA,1),simp), SB1:ev(part(SB,1),simp), *************** *** 884,889 **** FeedBack:"", /* Check they are equal */ ! SA:map(ineqreduce,map(trigreduce,SA)), ! SB:map(ineqreduce,map(trigreduce,SB)), if (subsetp(SA,SB) and subsetp(SB,SA)) then return([true,1,AnswerNote,FeedBack]), --- 924,929 ---- FeedBack:"", /* Check they are equal */ ! SA:map(stack_ineqprepare,map(trigreduce,SA)), ! SB:map(stack_ineqprepare,map(trigreduce,SB)), if (subsetp(SA,SB) and subsetp(SB,SA)) then return([true,1,AnswerNote,FeedBack]), *************** *** 1010,1045 **** )$ - /* Equations - Following added to work with ATSysEquiv answer test */ - stack_eqnprepare(ex):=block([ret], - ret:fullratsimp(trigexpand(rhs(ex)-lhs(ex))), - ret:ret*denom(ret), - return(expand(ret)) - )$ - - stack_assignmentp(ex):=block( - if atom(ex) then return(false) - else if op(ex)#"=" then return(false) - else if atom(lhs(ex)) and not(real_numberp(lhs(ex))) and real_numberp(rhs(ex)) then return(true) - else return(false) - )$ - - stack_assignmentrev(ex):=block( - if atom(ex) then return(ex) - else if op(ex)#"=" then return(ex) - else if real_numberp(lhs(ex)) and not(real_numberp(rhs(ex))) then return(rhs(ex)=lhs(ex)) - else return(ex) - )$ - - /* Take a list of equations, and re-evaluate it in the context of any assignments of the form d=10 - This is needed in practice with systems of equations, as students may write [d=10, d=v*t] */ - stack_eval_assignments(ex):= block([asl,sl], - if not(listp(ex)) then return(ex), - sl:maplist(stack_assignmentrev,ex), - asl:filter(stack_assignmentp,sl), - if not(emptyp(asl)) then - (sl:listify(setdifference(setify(sl),setify(asl))), - sl:ev(sl,asl)), - return(sl) - )$ /* This function makes a substitution of all variables for their lower case equivalents. --- 1050,1053 ---- *************** *** 1054,1058 **** return(subst(lv,ex)))$ - /**********************************************/ /* */ --- 1062,1065 ---- *************** *** 1114,1137 **** /* Are all list elements not atoms? */ ! if subsetp({true}, setify(maplist(atom, SA))) then return(StackReturnOb("0","ATSysEquiv_SA_not_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_eq_list"))), ! if subsetp({true}, setify(maplist(atom, SB))) then return(StackReturnOb("0","ATSysEquiv_SB_not_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_eq_list"))), /* Are all list elements equations? */ ! if is({"="}#setify(maplist(op,SA))) then return(StackReturnOb("0","ATSysEquiv_SA_not_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_eq_list"))), ! if is({"="}#setify(maplist(op,SB))) then return(StackReturnOb("0","ATSysEquiv_SB_not_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_eq_list"))), /* Turn our equations into expressions */ ! S1: maplist(stack_eqnprepare,stack_eval_assignments(exdowncase(SA))), ! S2: maplist(stack_eqnprepare,stack_eval_assignments(exdowncase(SB))), kill(SB), /* Is each expression a polynomial? */ ! if subsetp({false}, setify(maplist(polynomialpsimp, S1))) then return(StackReturnOb("0","ATSysEquiv_SA_not_poly_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_poly_eq_list"))), ! if subsetp({false}, setify(maplist(polynomialpsimp, S2))) then return(StackReturnOb("0","ATSysEquiv_SB_not_poly_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_poly_eq_list"))), --- 1121,1144 ---- /* Are all list elements not atoms? */ ! if ev(all_listp(atom,SA),simp) then return(StackReturnOb("0","ATSysEquiv_SA_not_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_eq_list"))), ! if ev(all_listp(atom,SB),simp) then return(StackReturnOb("0","ATSysEquiv_SB_not_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_eq_list"))), /* Are all list elements equations? */ ! if ev(not all_listp(equationp,SA),simp) then return(StackReturnOb("0","ATSysEquiv_SA_not_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_eq_list"))), ! if ev(not all_listp(equationp,SB),simp) then return(StackReturnOb("0","ATSysEquiv_SB_not_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_eq_list"))), /* Turn our equations into expressions */ ! S1: ev(maplist(stack_eqnprepare,stack_eval_assignments(exdowncase(SA))),simp), ! S2: ev(maplist(stack_eqnprepare,stack_eval_assignments(exdowncase(SB))),simp), kill(SB), /* Is each expression a polynomial? */ ! if not all_listp(polynomialpsimp, S1) then return(StackReturnOb("0","ATSysEquiv_SA_not_poly_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_poly_eq_list"))), ! if not all_listp(polynomialpsimp, S2) then return(StackReturnOb("0","ATSysEquiv_SB_not_poly_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_poly_eq_list"))), *************** *** 1147,1152 **** return(ATSysEquivVars(S1,S2)), ! GA :poly_buchberger(S1,varlist), ! GB :poly_buchberger(S2,varlist), kill(S1,S2), --- 1154,1159 ---- return(ATSysEquivVars(S1,S2)), ! GA :ev(poly_buchberger(S1,varlist),simp), ! GB :ev(poly_buchberger(S2,varlist),simp), kill(S1,S2), *************** *** 1209,1216 **** for k:1 thru length(S1) do block([], ! if poly_grobner_member(stack_eqnprepare(stack_eval_assignments(exdowncase(S1[k]))), GB, varlist) then ! ret:append(ret,[S1[k]]) else ! ret:append(ret,[texcolor("red", S1[k])])), return(StackReturnOb("0","ATSysEquiv_SA_system_overdetermined",StackAddFeedback("","ATSysEquiv_SA_system_overdetermined", StackDISP(ret, "\$\$")))) --- 1216,1223 ---- for k:1 thru length(S1) do block([], ! if ev(poly_grobner_member(stack_eqnprepare(stack_eval_assignments(exdowncase(S1[k]))), GB, varlist),simp) then ! ret:append(ret,[S1[ev(k,simp)]]) else ! ret:append(ret,[texcolor("red", S1[ev(k,simp)])])), return(StackReturnOb("0","ATSysEquiv_SA_system_overdetermined",StackAddFeedback("","ATSysEquiv_SA_system_overdetermined", StackDISP(ret, "\$\$")))) *************** *** 1219,1276 **** - /******************************************************************/ - - /* This takes an expression of the student and a list of expressions from the teacher. - The purpose of this test is to allow many comparisons with a single call to the CAS. - The results are returned in the AnswerNote as a list of lists, one list for each test - - 0 = false - 1 = true - -1 = test not applied (eg SameType=false, means no point in looking for algebraic equivalence) - - Three tests applied. - (1) SameType - (2) AlgEquiv - (3) Equal_com_ass - Validity, errors and feedback are not used in the main test. The "raw mark" is always 0. - */ - ATMultiEquiv(SA,SBl) :=block([ret,k,SAe,SB,SBe,SBlen,SBSameType,SBALgEquiv,SBEqualComAss,AnswerNote], - /* Error catch */ - if listp(SBl)=false then return(StackReturnOb("0","Teacher's answer not list","")), - SAe:errcatch(ev(SA,simp,fullratsimp,nouns)), - if is(SAe=[STACKERROR]) then return(StackReturnOb(0,"ATMultiEquiv_STACKERROR_SAns","")), - SBe:errcatch(ev(SBl,simp,fullratsimp,nouns)), - if is(SBe=[STACKERROR]) then return(StackReturnOb(0,"ATMultiEquiv_STACKERROR_TAns","")), - /* Set up return arrays */ - SBlen:length(SBl), - SBSameType:makelist(0,i,1,SBlen), - SBALgEquiv:makelist(0,i,1,SBlen), - SBEqualComAss:makelist(0,i,1,SBlen), - /* Loop over SBl */ - for k:1 thru SBlen step 1 do block( - k:ev(k,simp), - SB:SBl[k], - /* Are the expressions the same type? */ - ret:ATSameTypefun(SA,SB), - SBSameType[k]:ret[2], - if ret[2]=0 then - (SBALgEquiv[k]:-1,SBEqualComAss[k]:-1) - else block( - /* Check for Algebraic Equivalence */ - ret:block([simp:true,ret],ATAlgEquivfun(SA,SB)), - SBALgEquiv[k]:ret[2], - if ret[2]=0 then - (SBEqualComAss[k]:-1) - else block( - SBEqualComAss[k]:if equals_commute_associate(SA,SB) then 1 else 0 - ) - ) /* End of if AlgEquiv */ - ), /* End of loop over SBL */ - /* Send back results */ - AnswerNote:[SBSameType,SBALgEquiv,SBEqualComAss], - return(StackReturnOb("0",string(AnswerNote),"")) - )$ - - /*****************************************************************/ --- 1226,1229 ---- *************** *** 1619,1657 **** )$ - /*********************************************************/ - /* Test added by Chris Sangwin, 21/2/8. */ - /* Extends notion of "partial fractions" to equations */ - /* Needed for ECP's trials of the ODE code */ - /*********************************************************/ - - PartFracEq(SA,TA,var) := block([ret], - ret:ATAlgEquivfun(SA,SB), - if ret[2]=1 then block( - if equationp(TA) then - block ([ret1,ret2], - ret1:PartFracfun(lhs(SA),lhs(TA),var), - ret2:PartFracfun(rhs(SA),rhs(TA),var), - if ret1[2]=1 then - (if rhs(SA)=rhs(TA) then - true - else if ret2[2]=1 then - true - else - false - ) - else if ret2[2]=1 then - (if lhs(SA)=lhs(TA) then - true - else - false - ) - ) else - block ([ret:PartFracfun(SA,TA,var)], - ret[2] - ) - ) else - false - )$ - /* ************************ATSingFracTest****************************** */ /* requires: Student Answer */ --- 1572,1575 ---- *************** *** 1936,1939 **** --- 1854,1865 ---- )$ + /* This function strips off any trailing constant of integration from an expression, which is not a number */ + strip_int_const(ex,v):=block([ex2], + ex2:ex, + if not(atom(ex)) then + if op(ex)="+" then + ex2:apply("+",filter(lambda([ex2],not(freeof(v,ex2)) or simp_numberp(ex2)),args(ex))), + return(ex2))$ + /* An answer test for integration questions.*/ /* sa is the students' ansewer, sbl is a list consisting of (1) the answer, and (2) the variable */ *************** *** 1976,1983 **** val:true, rawmk:0, fb:"", ansnote:"", ret:[val,rawmk,ansnote,fb], ! SB:ev(SB,logexpand:super), /* This expands out logarithms for constants eg ln(k*|x|) */ ! if freeof(v,coeff(SB,v,0)) then SB:SB-coeff(SB,v,0), /* This strips off any trailing constant of integration from the teacher's answer */ ! SAa:ev(SA,logexpand:super)-coeff(ev(SA,logexpand:super),v,0), /* This strips off any trailing constant of integration */ ! /* check for constant of integration - code copied from Stack_Test */ ex:errcatch(ev(fullratsimp(SA-SB),simp,trigexpand:true,logexpand:super,keepfloat:true)), if ex=[] then return(false), --- 1902,1912 ---- val:true, rawmk:0, fb:"", ansnote:"", ret:[val,rawmk,ansnote,fb], ! /* This expands out logarithms for constants, e.g. ln(k*|x|) */ ! SB:ev(SB,logexpand:super), ! /* This strips off any trailing constant of integration from the teacher's answer */ ! SB:strip_int_const(SB,v), ! /* This strips off any trailing constant of integration from the student's answer */ ! SAa:strip_int_const(ev(SA,logexpand:super),v), ! /* Check for constant of integration - code copied from Stack_Test */ ex:errcatch(ev(fullratsimp(SA-SB),simp,trigexpand:true,logexpand:super,keepfloat:true)), if ex=[] then return(false), *************** *** 2109,2296 **** )$ - ATEquationfun(SA,SB,var,AT) := block([ret,ret0,ret1,ret2,lLHSv,lRHSv,mLHSv,mRHSv], - ret:ATEqnRet(SA,SB,var,"AE"), - ret0:ret, - - /* if is("I"=AT) then ( - lLHSv:append(listofvars(lhs(SA)),listofvars(lhs(SB))), - lRHSv:append(listofvars(rhs(SA)),listofvars(rhs(SB))), - mLHSv:member(var,lLHSv), - mRHSv:member(var,lRHSv) - ),*/ - - /* print("ATEqnRet for AE of SA with SB ",ret),*/ - if (is(ret[1]=true) and not(is("AE"=AT)))then block( - if (equationp(SB) and equationp(SA)) then block ([ret1,ret2], - ret1:ATEqnRet(lhs(SA),lhs(SB),var,AT), - /* print("ATEqnRet for AT LHSs of SA with SB ",ret1),*/ - ret2:ATEqnRet(rhs(SA),rhs(SB),var,AT), - /* print("ATEqnRet for AT RHSs of SA with SB ",ret2),*/ - if (ret1[3]=concat("ATE_unknowntest_",AT) or ret2[3]=concat("ATE_unknowntest_",AT)) then - ret:[false,0,ret1[3],""] - else ( - if (is(ret1[1]=false)) then /* Checks for validity of L and RHSs before continuing */ - if (is(ret2[1]=false)) then - ret:[false,0,concat(AT,"E_LF_RF"),""] - else - ret:[false,0,concat(AT,"E_LF_RV"),""] - else - if (is(ret2[1]=false)) then - ret:[false,0,concat(AT,"E_LV_RF"),""] - else block( - /* print("In [1]<>false else loop"),*/ - if (is(ret1[2]=1) and is(ret2[2]=1) and not(is(rhs(SA)=rhs(SB))) and not(is(lhs(SA)=lhs(SB)))) then - ret:[true,1,concat(AT,"E_L",AT,"_R",AT),""] /* e.g. PFE_LPF_RPF or IE_LI_RI */ - else - if (is(ret1[2]=0) and is(ret2[2]=0)) then block( - ret[2]:0, - ret[3]:concat(concat(AT,"E_N",AT)," ",ret1[3]," ",ret2[3]), /* the inner concat is probably unnecessary but is there for clarity, for now */ - ret[4]:concat(ret1[4],ret2[4]), - return(ret) - ) - else - if is(rhs(SA)=rhs(SB)) then block( - /* print("RHSs equal"),*/ - if is(lhs(SA)=lhs(SB)) then - if is(ret1[2]=1) then - if is(ret2[2]=1) then - ret[3]:concat(AT,"E_LU_RU") - else - (ret[3]:concat(concat(AT,"E_LU_RU")," ",ret2[3]),ret[2]:0) - else - if is(ret2[2]=1) then - (ret[3]:concat(concat(AT,"E_LU_RU")," ",ret1[3]),ret[2]:0) - else /* ret1[2]=0=ret2[2] */ - (ret[3]:concat(concat(AT,"E_LU_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else /* RHS equal, LHSs not equal */ - if is(ret1[2]=1) then - if is(ret2[2]=1) then - (ret[3]:concat(AT,"E_L",AT,"_RU"),ret[2]:1) - else - if (is(AT="I")) then - if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:1) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret2[3]),ret[2]:0) - else - if is(ret2[2]=1) then - if (is(AT="I")) then - if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:1) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0), - /* if is(ret1[2]=1) then - ret[3]:concat(AT,"E_L",AT,"_RU") - else - (ret[3]:concat(concat(AT,"E_LN",AT,"_RU")," ",ret1[3]),ret[2]:0), */ - return(ret) - ) /* RHSs not equal */ - else - if is(lhs(SA)=lhs(SB)) then block( - if is(ret1[2]=1) then - if is(ret2[2]=1) then - (ret[3]:concat(AT,"E_LU_R",AT),ret[2]:1) - else - if (is(AT="I")) then - if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) - else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:1) - else - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret2[3]),ret[2]:0) - else /* ret1[2]=0 */ - if is(ret2[2]=1) then - if (is(AT="I")) then - if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) - else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]," ",ret2[3]),ret[2]:1) - else - (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]),ret[2]:0) - else - if (is(AT="I")) then - if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) - else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:1) - else - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]),ret[2]:0), - return(ret) - ) - else - if is(ret1[2]=1) then - if (is(AT="I")) then - if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then - (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret1[3]," ",ret2[3]),ret[2]:1) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret1[3]," ",ret2[3]),ret[2]:0) - else - (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret2[3]),ret[2]:0) - else block( - ret[3]:concat(concat(AT,"E_LN_R",AT)," ",ret1[3]), - ret[2]:0, - return(ret) - ) - ) - ) - ) - else block( - ret:ATEqnRet(SA,SB,var,AT), - if is(ret[2]=0) then - ret[3]:concat(concat(AT,"E_not_eqns")," ",ret[3]) - else - ret[3]:concat(AT,"E_not_eqns") - ) - ) - else ( - if not(is("AE"=AT)) then - if equationp(SA) then - ret:[false,0,concat(AT,"E_SAE_SBN"),"ATAlgEquiv_SA_not_equation"] - else - if equationp(SB) then - ret:[false,0,concat(AT,"E_SBE_SAN"),"ATAlgEquiv_TA_not_equation"] - else - ret:[false,0,concat(AT,"E_NAE_other"),""] - ), - return(ret) - )$ - - ATEqnRet(cl,ll,opt,test) := block([rt], - if is(test="I") then - rt:Intfun(cl,ll,opt) - else if is(test="D") then - rt:Difffun(cl,ll,opt) - else if is(test="PF") then - if (atom(cl) or atom(ll)) then - rt:ATAlgEquivfun(cl,ll) - else - rt:PartFracfun(cl,ll,opt) - else if is(test="FF") then - rt:FacFormfun(cl,ll,opt) - else if is(test="AE") then - rt:ATAlgEquivfun(cl,ll) - else /* Something invalid passed */ - rt:[false,0,concat("ATE_unknowntest_",test),""], /* val,rawmk,ansnote,fb */ - return(rt) - )$ - /* Description : forme echelonne par lignes d'une matrice rectangulaire --- 2038,2041 ---- |
From: Chris S. <san...@us...> - 2010-11-09 14:50:37
|
Update of /cvsroot/stack/stack-dev/lib/answertests In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2562/lib/answertests Modified Files: Tag: grobner SysEquiv.php Log Message: Index: SysEquiv.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/Attic/SysEquiv.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** SysEquiv.php 9 Nov 2010 13:47:51 -0000 1.1.2.1 --- SysEquiv.php 9 Nov 2010 14:50:29 -0000 1.1.2.2 *************** *** 60,63 **** --- 60,64 ---- public function doAnsTest() { + $this->maximaPreferences->updateOption('Simplify', 'false'); $mconn = new maximaConnector($this->maximaPreferences); $result = $mconn->sendAnsTest($this->sAnsKey,$this->tAnsKey, self::casFunction); |
From: Chris S. <san...@us...> - 2010-11-09 14:50:29
|
Update of /cvsroot/stack/stack-dev/lang/en In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2538/lang/en Modified Files: Tag: grobner stack.php Log Message: Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lang/en/stack.php,v retrieving revision 1.160.2.2 retrieving revision 1.160.2.3 diff -C2 -d -r1.160.2.2 -r1.160.2.3 *** stack.php 9 Nov 2010 14:13:49 -0000 1.160.2.2 --- stack.php 9 Nov 2010 14:50:20 -0000 1.160.2.3 *************** *** 354,364 **** $string['ATNumSigFigs_Inaccurate'] = 'The accuracy of your answer is not correct. Either you have rounded correctly, or you have rounded an intermediate answer which propagates an error.'; $string['ATNumSigFigs_WrongDigits'] = 'Your answer contains the wrong number of significant digits. '; ! $string['ATSysEquiv_SA_not_list'] = 'Your answer should be a list, but it is not!'; ! $string['ATSysEquiv_SB_not_list'] = 'Teacher answer is not a list'; $string['ATSysEquiv_SA_not_eq_list'] = 'Your answer should be a list of equations, but it is not!'; $string['ATSysEquiv_SB_not_eq_list'] = 'Teacher answer is not a list of equations'; $string['ATSysEquiv_SA_not_poly_eq_list'] = 'One or more of your equations is not a polynomial!'; ! $string['ATSysEquiv_SB_not_poly_eq_list'] = 'Teacher answer is not a list of polynomial equations'; $string['ATSysEquiv_SA_missing_variables'] = 'Your answer is missing one or more variables!'; $string['ATSysEquiv_SA_extra_variables'] = 'Your answer includes too many variables!'; --- 354,364 ---- $string['ATNumSigFigs_Inaccurate'] = 'The accuracy of your answer is not correct. Either you have rounded correctly, or you have rounded an intermediate answer which propagates an error.'; $string['ATNumSigFigs_WrongDigits'] = 'Your answer contains the wrong number of significant digits. '; ! $string['ATSysEquiv_SA_not_list'] = 'Your answer should be a list, but it is not!'; ! $string['ATSysEquiv_SB_not_list'] = 'The Teacher\'s answer is not a list. Please contact your teacher.'; $string['ATSysEquiv_SA_not_eq_list'] = 'Your answer should be a list of equations, but it is not!'; $string['ATSysEquiv_SB_not_eq_list'] = 'Teacher answer is not a list of equations'; $string['ATSysEquiv_SA_not_poly_eq_list'] = 'One or more of your equations is not a polynomial!'; ! $string['ATSysEquiv_SB_not_poly_eq_list'] = 'The Teacher\'s answer should be a list of polynomial equations, but is not. Please contact your teacher.'; $string['ATSysEquiv_SA_missing_variables'] = 'Your answer is missing one or more variables!'; $string['ATSysEquiv_SA_extra_variables'] = 'Your answer includes too many variables!'; |
From: Matthew B. <ba...@us...> - 2010-11-09 14:13:57
|
Update of /cvsroot/stack/stack-dev/lang/en In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25677/lang/en Modified Files: Tag: grobner stack.php Log Message: Updated language file. Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lang/en/stack.php,v retrieving revision 1.160.2.1 retrieving revision 1.160.2.2 diff -C2 -d -r1.160.2.1 -r1.160.2.2 *** stack.php 9 Nov 2010 13:39:40 -0000 1.160.2.1 --- stack.php 9 Nov 2010 14:13:49 -0000 1.160.2.2 *************** *** 190,193 **** --- 190,194 ---- $string['stackOptions_AnsTest_values_RegExp'] = "RegExp"; $string['stackOptions_AnsTest_values_EquationAT'] = "EquationAT"; + $string['stackOptions_AnsTest_values_SysEquiv'] = "SysEquiv"; $string['stackOptions_AssumePos_values_true'] = "true"; |
From: Matthew B. <ba...@us...> - 2010-11-09 13:47:59
|
Update of /cvsroot/stack/stack-dev/lib/answertests In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv17949/lib/answertests Modified Files: Tag: grobner AnsTestController.php Added Files: Tag: grobner SysEquiv.php Log Message: Missed a few lib files. --- NEW FILE: SysEquiv.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * * This file is licensed under the GPL License. * * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * * @author Jonathan Hart (j.p...@bh...) * * @package stackAnswertest */ global $config; require_once $config->get('docroot').'/lib/items/CasString.php'; require_once $config->get('docroot').'/lib/CAS/maximaConnector.php'; require_once 'AnsTest.php'; /** * detailed description * * @author * @version * @copyright */ class SysEquiv extends AnsTest { // Attributes // Associations // Operations /** * constant * The name of the cas function this answer test uses. */ const casFunction = 'ATSysEquiv'; /** * * * @param string $sAnsKey * @param string $tAnsKey * @param CasString $casOption * @access public */ public function __construct($sAnsKey, $tAnsKey, $maximaPreferencs, $casOption = NULL) { parent::__construct($sAnsKey, $tAnsKey, $maximaPreferencs, $casOption); } /** * * * @return bool * @access public */ public function doAnsTest() { $mconn = new maximaConnector($this->maximaPreferences); $result = $mconn->sendAnsTest($this->sAnsKey,$this->tAnsKey, self::casFunction); $this->ATMark = $result['rawmark']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; $this->ATError = $result['error']; if($this->ATMark == '1') { //echo '<strong>Returning true</strong>'; return true; } else { //echo '<strong>Returning false</strong>'; return false; } } } ?> Index: AnsTestController.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/AnsTestController.php,v retrieving revision 1.34 retrieving revision 1.34.8.1 diff -C2 -d -r1.34 -r1.34.8.1 *** AnsTestController.php 30 Oct 2009 16:43:36 -0000 1.34 --- AnsTestController.php 9 Nov 2010 13:47:51 -0000 1.34.8.1 *************** *** 80,83 **** --- 80,84 ---- 'StringSloppy'=>get_string('stackOptions_AnsTest_values_StringSloppy','stack',''), 'RegExp'=>get_string('stackOptions_AnsTest_values_RegExp','stack',''), + 'SysEquiv'=>get_string('stackOptions_AnsTest_values_SysEquiv','stack',''), ); //echo "<br>In Anstest controller: $AnsTest<br>"; *************** *** 190,193 **** --- 191,199 ---- break; + case 'SysEquiv': + require_once 'SysEquiv.php'; + $this->AT = new SysEquiv($sAns, $tAns, $maximaPreferences, $AnsTestOption); + break; + // The following two are only used in the module ODE and should not be available for questions. // CJS, 30/10/9 |
From: Chris S. <san...@us...> - 2010-11-09 13:42:05
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv16328/maxima Modified Files: stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** stackmaxima.mac 1 Nov 2010 14:34:29 -0000 1.84 --- stackmaxima.mac 9 Nov 2010 13:41:57 -0000 1.85 *************** *** 245,254 **** ); ! /* ******************************************* */ ! /* A return object string */ ! /* */ ! /* rawmk should be a float/int between 0 and 1 */ ! /* amswernote, is for teacher stats */ ! /* ******************************************* */ StackReturnOb(rawmk,ansnote,fb):=block([str], --- 245,254 ---- ); ! /* ********************************************* */ ! /* A return object string */ ! /* */ ! /* rawmark should be a float/int between 0 and 1 */ ! /* answernote, is for teacher stats */ ! /* ********************************************* */ StackReturnOb(rawmk,ansnote,fb):=block([str], |
From: Matthew B. <ba...@us...> - 2010-11-09 13:39:48
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv15447/maxima Modified Files: Tag: grobner stackmaxima.mac Log Message: Code for the SysEquiv answer test. Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84 retrieving revision 1.84.2.1 diff -C2 -d -r1.84 -r1.84.2.1 *** stackmaxima.mac 1 Nov 2010 14:34:29 -0000 1.84 --- stackmaxima.mac 9 Nov 2010 13:39:39 -0000 1.84.2.1 *************** *** 51,55 **** --- 51,57 ---- stack_reset(1000); + alias(int,integrate); /* Allows integrate to be called with int() */ + alias(ln,log); alias(simplify,fullratsimp); /* Allows simplify to be something */ *************** *** 60,72 **** /* ********************************** */ - /* Logarithms */ - /* ********************************** */ - alias(ln,log); - load("log10"); - texput(log10,"\\log\\mathrm{10}",prefix); - alias(lg,log10); - texput(lg,"\\mathrm{lg}",prefix); - - /* ********************************** */ /* Load contributed packages */ /* ********************************** */ --- 62,65 ---- *************** *** 267,272 **** exs:errcatch(ev(expr,simp)), if exs=[] then return(false), - if length(expr)#1 then print(StackAddFeedback("","CommaError",string(expr),string(setify(expr)))), - expr:first(expr), /* Check for floats, and if there are any then throw an error */ if ForbidFloats and anyfloatex(expr) then --- 260,263 ---- *************** *** 285,304 **** )$ ! /*validate an expression without type checking. Floats and mathematical errors only. */ ! stack_validate_typeless(expr,ForbidFloats,LowestTerms) := block( [simp:false,exs], /* Try to simply the expression to catch CAS errors */ ! exs:errcatch(ev(expr,simp)), if exs=[] then return(false), - if length(expr)#1 then print(StackAddFeedback("","CommaError",expr,setify(expr))), - expr:first(expr), /* Check for floats, and if there are any then throw an error */ ! if ForbidFloats and anyfloatex(expr) then print(StackAddFeedback("","Illegal_floats")), /* Checks fractions are in lowest terms */ ! if LowestTerms and all_lowest_termsex(expr)=false then print(StackAddFeedback("","Lowest_Terms")), /* Now display the result */ simp:false, ! return(expr) )$ --- 276,293 ---- )$ ! /*JPH validate an expression without type checking. Floats and mathematical errors only. */ ! stack_validate_typeless(ex,ForbidFloats,LowestTerms) := block( [simp:false,exs], /* Try to simply the expression to catch CAS errors */ ! exs:errcatch(ev(ex,simp)), if exs=[] then return(false), /* Check for floats, and if there are any then throw an error */ ! if ForbidFloats and anyfloatex(ex) then print(StackAddFeedback("","Illegal_floats")), /* Checks fractions are in lowest terms */ ! if LowestTerms and all_lowest_termsex(ex)=false then print(StackAddFeedback("","Lowest_Terms")), /* Now display the result */ simp:false, ! return(ex) )$ *************** *** 400,403 **** --- 389,397 ---- /* ********************************** */ + if is(MAXIMA_VERSION_NUM <= 5.12) then block( + round(x) := ?round(x), + truncate(x) := ?truncate(x) + ); + /* numberp() does not "work" when simp:false, since unary minus is an unevaluated function... */ simp_numberp(ex) := block( *************** *** 422,425 **** --- 416,433 ---- )$ + + stack_matrix_size(m) := block( + mLength : length(m), + if(mLength > 0) then mWidth : length(m[1]) + else mWidth : 0, + + ret : [mLength, mWidth], + return(ret))$ + + if is(MAXIMA_VERSION_NUM <= 5.11) then block( + matrix_size(x) := stack_matrix_size(x) + ); /* MAXMA >= 5.12 includes matrix_size function. JPH 10-12-07 */ + + decimalplaces(x,n) := block([simp:true,fpprintprec],fpprintprec:n,float(round(10^n*float(x))/(10^n)))$ *************** *** 478,482 **** ); ! /* commonfac(l) returns the gcd of a list of numbers */ commonfaclist(l) := block([i,a,ret], if listp(l) then --- 486,490 ---- ); ! /* commonfac(l) returns the hcf of a list of numbers */ commonfaclist(l) := block([i,a,ret], if listp(l) then *************** *** 508,511 **** --- 516,529 ---- )$ + /* Old code 25/9/9 + ex1:part(ex,1), + ex2:part(ex,2), + ex1:ev(setify(factorlist(ex1)),simp), + ex2:ev(setify(factorlist(ex2)),simp), + ex3:intersect(ex1,ex2), + if ex3={} then return(true), + return(false) + */ + /* Create a list with all parts for which numberp(ex)=true */ list_expression_numbers(ex) := block([ex2], *************** *** 572,592 **** )$ - /* ********************************** */ - /* Parts of expressions */ - /* ********************************** */ - - /* op(ex) is unsafe on atoms: this is a fix. */ - /* This function always returns a string */ - stack_op(ex) := block( - if atom(ex) then return(""), - if op(ex)#"-" then - if stringp(op(ex)) then return(op(ex)) else return(string(op(ex))) - else - if atom(first(ex)) then - return("") - else - if stringp(op(first(ex))) then return(op((first(ex)))) else return(string(op(ex))) - )$ - /* This function takes an expression ex and returns a list of coefficients of v */ coeff_list(ex,v):= block([deg,kloop,cl], --- 590,593 ---- *************** *** 628,631 **** --- 629,645 ---- )$ + /* Reduces an inequality to either ? > 0 or ? >=0 */ + ineqreduce(ex) := block([op2,ex2], + if atom(ex) then return(ex), + if op(ex)="=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) = 0), + if op(ex)=">" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) > 0), + if op(ex)=">=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) >= 0), + if op(ex)="<" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) > 0), + if op(ex)="<=" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) >= 0), + ex2:args(ex), + ex2:map(ineqreduce,ex2), + return(apply(op(ex),ex2)) + )$ + expressionp(ex) := block( if matrixp(ex) or listp(ex) or equationp(ex) or inequalityp(ex) or setp(ex) then *************** *** 755,761 **** /* Otherwise we have two expressions*/ if Stack_Test(SA,SB) then ! RawMark:1 ! else if Stack_Test(exdowncase(SA),exdowncase(SB)) then ! AnswerNote:"ATAlgEquiv WrongCase ", ret:[true,RawMark,AnswerNote,FeedBack], return(ret) --- 769,773 ---- /* Otherwise we have two expressions*/ if Stack_Test(SA,SB) then ! RawMark:1, ret:[true,RawMark,AnswerNote,FeedBack], return(ret) *************** *** 765,769 **** ATList(SA,SB):= block([AddFeedBack,SAN,SAl,SBl,ret,retnew,k], ! /* Get sizes of lists */ SAN : SA, SAl : length(SA), --- 777,781 ---- ATList(SA,SB):= block([AddFeedBack,SAN,SAl,SBl,ret,retnew,k], ! /* Get sizes of matrices */ SAN : SA, SAl : length(SA), *************** *** 775,779 **** ret:[true,1,"",""], AddFeedBack:false, ! for k:1 thru SAl do block([retnew], retnew:ATAlgEquivfun(SA[k],SB[k]), ret[1]:ret[1] and retnew[1], --- 787,791 ---- ret:[true,1,"",""], AddFeedBack:false, ! for k:1 thru SAl do block( retnew:ATAlgEquivfun(SA[k],SB[k]), ret[1]:ret[1] and retnew[1], *************** *** 793,842 **** )$ - /* Equations */ - stack_eqnprepare(ex):=block([ret], - ret:fullratsimp(trigexpand(rhs(ex)-lhs(ex))), - ret:ret*denom(ret), - return(expand(ret)) - )$ - - stack_eqncompare(SA,SB,sl):=block([ret,G0,G1], - G0 :poly_buchberger(SA,sl), - G1 :poly_buchberger(SB,sl), - ret:poly_grobner_equal(G0,G1,sl), - return(ret) - )$ - - stack_assignmentp(ex):=block( - if atom(ex) then return(false) - else if op(ex)#"=" then return(false) - else if atom(lhs(ex)) and not(real_numberp(lhs(ex))) and real_numberp(rhs(ex)) then return(true) - else return(false) - )$ - - stack_assignmentrev(ex):=block( - if atom(ex) then return(ex) - else if op(ex)#"=" then return(ex) - else if real_numberp(lhs(ex)) and not(real_numberp(rhs(ex))) then return(rhs(ex)=lhs(ex)) - else return(ex) - )$ - - /* Take a list of equations, and re-evaluate it in the context of any assignments of the form d=10 - This is needed in practice with systems of equations, as students may write [d=10, d=v*t] */ - stack_eval_assignments(ex):= block([asl,sl], - if not(listp(ex)) then return(ex), - sl:maplist(stack_assignmentrev,ex), - asl:filter(stack_assignmentp,sl), - if not(emptyp(asl)) then - (sl:listify(setdifference(setify(sl),setify(asl))), - sl:ev(sl,asl)), - return(sl) - )$ - /* Two equations are the "same" when they have identical roots with identical multiplicities */ ATEquation(SA,SB):= block([RawMark,SA1,SB1,SB2], RawMark:0, ! SA1:stack_eqnprepare(SA), ! SB1:stack_eqnprepare(SB), if SA1#0 then /* We need a slight hack to turn %i+1 into a number */ --- 805,816 ---- )$ /* Two equations are the "same" when they have identical roots with identical multiplicities */ ATEquation(SA,SB):= block([RawMark,SA1,SB1,SB2], RawMark:0, ! SA1:fullratsimp(trigexpand(rhs(SA)-lhs(SA))), ! SB1:fullratsimp(trigexpand(rhs(SB)-lhs(SB))), ! SA1:SA1*denom(SA1), ! SB1:SB1*denom(SB1), if SA1#0 then /* We need a slight hack to turn %i+1 into a number */ *************** *** 847,869 **** )$ - /* Reduces an inequality to either ? > 0 or ? >=0 */ - stack_ineqprepare(ex) := block([op2,ex2], - if atom(ex) then return(ex), - if op(ex)="=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) = 0), - if op(ex)=">" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) > 0), - if op(ex)=">=" then return(ev(part(ex,1) - part(ex,2),simp,trigreduce) >= 0), - if op(ex)="<" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) > 0), - if op(ex)="<=" then return(ev(part(ex,2) - part(ex,1),simp,trigreduce) >= 0), - ex2:args(ex), - ex2:map(stack_ineqprepare,ex2), - return(apply(op(ex),ex2)) - )$ - - ATInequality(SA,SB):= block([RawMark,FeedBack,AnswerNote,SA1,SB1,samex], RawMark:0, FeedBack:"", AnswerNote:"", ! SA:stack_ineqprepare(SA), ! SB:stack_ineqprepare(SB), SA1:ev(part(SA,1),simp), SB1:ev(part(SB,1),simp), --- 821,829 ---- )$ ATInequality(SA,SB):= block([RawMark,FeedBack,AnswerNote,SA1,SB1,samex], RawMark:0, FeedBack:"", AnswerNote:"", ! SA:ineqreduce(SA), ! SB:ineqreduce(SB), SA1:ev(part(SA,1),simp), SB1:ev(part(SB,1),simp), *************** *** 924,929 **** FeedBack:"", /* Check they are equal */ ! SA:map(stack_ineqprepare,map(trigreduce,SA)), ! SB:map(stack_ineqprepare,map(trigreduce,SB)), if (subsetp(SA,SB) and subsetp(SB,SA)) then return([true,1,AnswerNote,FeedBack]), --- 884,889 ---- FeedBack:"", /* Check they are equal */ ! SA:map(ineqreduce,map(trigreduce,SA)), ! SB:map(ineqreduce,map(trigreduce,SB)), if (subsetp(SA,SB) and subsetp(SB,SA)) then return([true,1,AnswerNote,FeedBack]), *************** *** 1050,1053 **** --- 1010,1045 ---- )$ + /* Equations - Following added to work with ATSysEquiv answer test */ + stack_eqnprepare(ex):=block([ret], + ret:fullratsimp(trigexpand(rhs(ex)-lhs(ex))), + ret:ret*denom(ret), + return(expand(ret)) + )$ + + stack_assignmentp(ex):=block( + if atom(ex) then return(false) + else if op(ex)#"=" then return(false) + else if atom(lhs(ex)) and not(real_numberp(lhs(ex))) and real_numberp(rhs(ex)) then return(true) + else return(false) + )$ + + stack_assignmentrev(ex):=block( + if atom(ex) then return(ex) + else if op(ex)#"=" then return(ex) + else if real_numberp(lhs(ex)) and not(real_numberp(rhs(ex))) then return(rhs(ex)=lhs(ex)) + else return(ex) + )$ + + /* Take a list of equations, and re-evaluate it in the context of any assignments of the form d=10 + This is needed in practice with systems of equations, as students may write [d=10, d=v*t] */ + stack_eval_assignments(ex):= block([asl,sl], + if not(listp(ex)) then return(ex), + sl:maplist(stack_assignmentrev,ex), + asl:filter(stack_assignmentp,sl), + if not(emptyp(asl)) then + (sl:listify(setdifference(setify(sl),setify(asl))), + sl:ev(sl,asl)), + return(sl) + )$ /* This function makes a substitution of all variables for their lower case equivalents. *************** *** 1063,1066 **** --- 1055,1276 ---- + /**********************************************/ + /* */ + /* System Equivalence Test */ + /* */ + /* An addition to STACK using Grobner Bases */ + /* */ + /**********************************************/ + + + /* + + What these functions do: + + - Determine whether the student's and teacher's answers are systems of equations + - Convert the two systems of equations into two systems of expressions + - Determine whether both systems are systems of multivariate polynomials + - Compare the variables in student's and teacher's answers, if they're not the same tell the student + - Find their Buchberger polynomials of the two systems + - Use the Buchberger polynomials to compare the Grobner bases of the two systems + - If the Grobner bases are not equal, determine whether the student's is a subset of the teacher's + - If student's system has equations which should not be there, tell them which ones. + */ + + + + /* + Main function of the System Equivalence test + + Takes two inputs, checks whether they are + lists of polynomials and delegates everything + else to other functions. + + Process: + + - Is each answer a list? + - Is each list element not an atom? + - Is each list element an equation? + - Is each list element a polynomial? + */ + + /* Edited files: SysEquiv.php, AnsTestcontroller.php, lang/en/stack.php */ + + ATSysEquiv(SA,SB):=block([keepfloat,RawMark,FeedBack,AnswerNote,SAA,SAB,S1,S2,varlist,GA,GB,ret], + RawMark:0, FeedBack:"", AnswerNote:"", + keepfloat:true, /* See pg 23 */ + + /* Turn on simplification and error catch */ + SAA:errcatch(ev(SA,simp,fullratsimp,nouns)), + if (is(SAA=[STACKERROR]) or is(SAA=[])) then return(StackReturnOb("0","ATLowestTerms_STACKERROR_SAns","")), + SAB:errcatch(ev(SB,simp,fullratsimp,nouns)), + if (is(SAB=[STACKERROR]) or is(SAB=[])) then return(StackReturnOb("0","ATLowestTerms_STACKERROR_TAns","")), + + /* Are both answers lists? */ + if not listp(SA) then + return(StackReturnOb("0","ATSysEquiv_SA_not_list",StackAddFeedback("","ATSysEquiv_SA_not_list"))), + if not listp(SB) then + return(StackReturnOb("0","ATSysEquiv_SB_not_list",StackAddFeedback("","ATSysEquiv_SB_not_list"))), + + /* Are all list elements not atoms? */ + if subsetp({true}, setify(maplist(atom, SA))) then + return(StackReturnOb("0","ATSysEquiv_SA_not_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_eq_list"))), + if subsetp({true}, setify(maplist(atom, SB))) then + return(StackReturnOb("0","ATSysEquiv_SB_not_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_eq_list"))), + + /* Are all list elements equations? */ + if is({"="}#setify(maplist(op,SA))) then + return(StackReturnOb("0","ATSysEquiv_SA_not_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_eq_list"))), + if is({"="}#setify(maplist(op,SB))) then + return(StackReturnOb("0","ATSysEquiv_SB_not_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_eq_list"))), + + /* Turn our equations into expressions */ + S1: maplist(stack_eqnprepare,stack_eval_assignments(exdowncase(SA))), + S2: maplist(stack_eqnprepare,stack_eval_assignments(exdowncase(SB))), + kill(SB), + + /* Is each expression a polynomial? */ + if subsetp({false}, setify(maplist(polynomialpsimp, S1))) then + return(StackReturnOb("0","ATSysEquiv_SA_not_poly_eq_list",StackAddFeedback("","ATSysEquiv_SA_not_poly_eq_list"))), + if subsetp({false}, setify(maplist(polynomialpsimp, S2))) then + return(StackReturnOb("0","ATSysEquiv_SB_not_poly_eq_list",StackAddFeedback("","ATSysEquiv_SB_not_poly_eq_list"))), + + /* + At this point have two lists of polynomials. We now check whether the + student's and teacher's polynomials have the same variables. If they do, + we find their Grobner bases and determine whether the systems of + equations have the same solutions + */ + + varlist: listofvars(S2), + if not is(listofvars(S1)=varlist) then + return(ATSysEquivVars(S1,S2)), + + GA :poly_buchberger(S1,varlist), + GB :poly_buchberger(S2,varlist), + kill(S1,S2), + + /* Determine whether our two lists of polynomials have the same Grobner Bases */ + if poly_grobner_equal(GA, GB, varlist) then + return(StackReturnOb("1","","")), + + /* + We now know the student's answer is in the correct form but there is + something wrong with it. From here we use the grobner package to + determine which, if any, of their equations is correct. + */ + + return(ATSysEquivGrob(GA, GB, SA, varlist)) + + + )$ + + + /* Checks that an expression is a polynomial */ + + polynomialpsimp(e):=block([], + return(polynomialp(e, listofvars(e))) + )$ + + + /* Takes two lists of expressions and compares the variables in each */ + + ATSysEquivVars(S1,S2):=block([XA,XB], + XA: setify(listofvars(S1)), + XB: setify(listofvars(S2)), + if subsetp(XA,XB) then + return(StackReturnOb("0","ATSysEquiv_SA_missing_variables",StackAddFeedback("","ATSysEquiv_SA_missing_variables"))), + if subsetp(XB,XA) then + return(StackReturnOb("0","ATSysEquiv_SA_extra_variables",StackAddFeedback("","ATSysEquiv_SA_extra_variables"))) + )$ + + /* + Grobner basis comparison + + This function takes two Grobner bases and a set of variables and determines + whether the student's system is underdetermined or overdetermined. It also + takes the student's original system so that if it is overdetermined it can + tell them which equations should not be there. + */ + + ATSysEquivGrob(GA,GB,S1,varlist):=block([retl,ret], + + /* Is the student's system underdetermined? */ + + if poly_grobner_subsetp(GA,GB,varlist) then + return(StackReturnOb("0","ATSysEquiv_SA_system_underdetermined",StackAddFeedback("","ATSysEquiv_SA_system_underdetermined"))), + + /* + Given that the student's system is neither underdetermined nor equal to + the teacher's, we need to find which equations do not belong in the system. + */ + + ret:[], + + for k:1 thru length(S1) do block([], + if poly_grobner_member(stack_eqnprepare(stack_eval_assignments(exdowncase(S1[k]))), GB, varlist) then + ret:append(ret,[S1[k]]) + else + ret:append(ret,[texcolor("red", S1[k])])), + + return(StackReturnOb("0","ATSysEquiv_SA_system_overdetermined",StackAddFeedback("","ATSysEquiv_SA_system_overdetermined", StackDISP(ret, "\$\$")))) + + )$ + + + /******************************************************************/ + + /* This takes an expression of the student and a list of expressions from the teacher. + The purpose of this test is to allow many comparisons with a single call to the CAS. + The results are returned in the AnswerNote as a list of lists, one list for each test + + 0 = false + 1 = true + -1 = test not applied (eg SameType=false, means no point in looking for algebraic equivalence) + + Three tests applied. + (1) SameType + (2) AlgEquiv + (3) Equal_com_ass + Validity, errors and feedback are not used in the main test. The "raw mark" is always 0. + */ + ATMultiEquiv(SA,SBl) :=block([ret,k,SAe,SB,SBe,SBlen,SBSameType,SBALgEquiv,SBEqualComAss,AnswerNote], + /* Error catch */ + if listp(SBl)=false then return(StackReturnOb("0","Teacher's answer not list","")), + SAe:errcatch(ev(SA,simp,fullratsimp,nouns)), + if is(SAe=[STACKERROR]) then return(StackReturnOb(0,"ATMultiEquiv_STACKERROR_SAns","")), + SBe:errcatch(ev(SBl,simp,fullratsimp,nouns)), + if is(SBe=[STACKERROR]) then return(StackReturnOb(0,"ATMultiEquiv_STACKERROR_TAns","")), + /* Set up return arrays */ + SBlen:length(SBl), + SBSameType:makelist(0,i,1,SBlen), + SBALgEquiv:makelist(0,i,1,SBlen), + SBEqualComAss:makelist(0,i,1,SBlen), + /* Loop over SBl */ + for k:1 thru SBlen step 1 do block( + k:ev(k,simp), + SB:SBl[k], + /* Are the expressions the same type? */ + ret:ATSameTypefun(SA,SB), + SBSameType[k]:ret[2], + if ret[2]=0 then + (SBALgEquiv[k]:-1,SBEqualComAss[k]:-1) + else block( + /* Check for Algebraic Equivalence */ + ret:block([simp:true,ret],ATAlgEquivfun(SA,SB)), + SBALgEquiv[k]:ret[2], + if ret[2]=0 then + (SBEqualComAss[k]:-1) + else block( + SBEqualComAss[k]:if equals_commute_associate(SA,SB) then 1 else 0 + ) + ) /* End of if AlgEquiv */ + ), /* End of loop over SBL */ + /* Send back results */ + AnswerNote:[SBSameType,SBALgEquiv,SBEqualComAss], + return(StackReturnOb("0",string(AnswerNote),"")) + )$ + + /*****************************************************************/ *************** *** 1409,1412 **** --- 1619,1657 ---- )$ + /*********************************************************/ + /* Test added by Chris Sangwin, 21/2/8. */ + /* Extends notion of "partial fractions" to equations */ + /* Needed for ECP's trials of the ODE code */ + /*********************************************************/ + + PartFracEq(SA,TA,var) := block([ret], + ret:ATAlgEquivfun(SA,SB), + if ret[2]=1 then block( + if equationp(TA) then + block ([ret1,ret2], + ret1:PartFracfun(lhs(SA),lhs(TA),var), + ret2:PartFracfun(rhs(SA),rhs(TA),var), + if ret1[2]=1 then + (if rhs(SA)=rhs(TA) then + true + else if ret2[2]=1 then + true + else + false + ) + else if ret2[2]=1 then + (if lhs(SA)=lhs(TA) then + true + else + false + ) + ) else + block ([ret:PartFracfun(SA,TA,var)], + ret[2] + ) + ) else + false + )$ + /* ************************ATSingFracTest****************************** */ /* requires: Student Answer */ *************** *** 1691,1702 **** )$ - /* This function strips off any trailing constant of integration from an expression, which is not a number */ - strip_int_const(ex,v):=block([ex2], - ex2:ex, - if not(atom(ex)) then - if op(ex)="+" then - ex2:apply("+",filter(lambda([ex2],not(freeof(v,ex2)) or simp_numberp(ex2)),args(ex))), - return(ex2))$ - /* An answer test for integration questions.*/ /* sa is the students' ansewer, sbl is a list consisting of (1) the answer, and (2) the variable */ --- 1936,1939 ---- *************** *** 1739,1749 **** val:true, rawmk:0, fb:"", ansnote:"", ret:[val,rawmk,ansnote,fb], ! /* This expands out logarithms for constants, e.g. ln(k*|x|) */ ! SB:ev(SB,logexpand:super), ! /* This strips off any trailing constant of integration from the teacher's answer */ ! SB:strip_int_const(SB,v), ! /* This strips off any trailing constant of integration from the student's answer */ ! SAa:strip_int_const(ev(SA,logexpand:super),v), ! /* Check for constant of integration - code copied from Stack_Test */ ex:errcatch(ev(fullratsimp(SA-SB),simp,trigexpand:true,logexpand:super,keepfloat:true)), if ex=[] then return(false), --- 1976,1983 ---- val:true, rawmk:0, fb:"", ansnote:"", ret:[val,rawmk,ansnote,fb], ! SB:ev(SB,logexpand:super), /* This expands out logarithms for constants eg ln(k*|x|) */ ! if freeof(v,coeff(SB,v,0)) then SB:SB-coeff(SB,v,0), /* This strips off any trailing constant of integration from the teacher's answer */ ! SAa:ev(SA,logexpand:super)-coeff(ev(SA,logexpand:super),v,0), /* This strips off any trailing constant of integration */ ! /* check for constant of integration - code copied from Stack_Test */ ex:errcatch(ev(fullratsimp(SA-SB),simp,trigexpand:true,logexpand:super,keepfloat:true)), if ex=[] then return(false), *************** *** 1875,1878 **** --- 2109,2296 ---- )$ + ATEquationfun(SA,SB,var,AT) := block([ret,ret0,ret1,ret2,lLHSv,lRHSv,mLHSv,mRHSv], + ret:ATEqnRet(SA,SB,var,"AE"), + ret0:ret, + + /* if is("I"=AT) then ( + lLHSv:append(listofvars(lhs(SA)),listofvars(lhs(SB))), + lRHSv:append(listofvars(rhs(SA)),listofvars(rhs(SB))), + mLHSv:member(var,lLHSv), + mRHSv:member(var,lRHSv) + ),*/ + + /* print("ATEqnRet for AE of SA with SB ",ret),*/ + if (is(ret[1]=true) and not(is("AE"=AT)))then block( + if (equationp(SB) and equationp(SA)) then block ([ret1,ret2], + ret1:ATEqnRet(lhs(SA),lhs(SB),var,AT), + /* print("ATEqnRet for AT LHSs of SA with SB ",ret1),*/ + ret2:ATEqnRet(rhs(SA),rhs(SB),var,AT), + /* print("ATEqnRet for AT RHSs of SA with SB ",ret2),*/ + if (ret1[3]=concat("ATE_unknowntest_",AT) or ret2[3]=concat("ATE_unknowntest_",AT)) then + ret:[false,0,ret1[3],""] + else ( + if (is(ret1[1]=false)) then /* Checks for validity of L and RHSs before continuing */ + if (is(ret2[1]=false)) then + ret:[false,0,concat(AT,"E_LF_RF"),""] + else + ret:[false,0,concat(AT,"E_LF_RV"),""] + else + if (is(ret2[1]=false)) then + ret:[false,0,concat(AT,"E_LV_RF"),""] + else block( + /* print("In [1]<>false else loop"),*/ + if (is(ret1[2]=1) and is(ret2[2]=1) and not(is(rhs(SA)=rhs(SB))) and not(is(lhs(SA)=lhs(SB)))) then + ret:[true,1,concat(AT,"E_L",AT,"_R",AT),""] /* e.g. PFE_LPF_RPF or IE_LI_RI */ + else + if (is(ret1[2]=0) and is(ret2[2]=0)) then block( + ret[2]:0, + ret[3]:concat(concat(AT,"E_N",AT)," ",ret1[3]," ",ret2[3]), /* the inner concat is probably unnecessary but is there for clarity, for now */ + ret[4]:concat(ret1[4],ret2[4]), + return(ret) + ) + else + if is(rhs(SA)=rhs(SB)) then block( + /* print("RHSs equal"),*/ + if is(lhs(SA)=lhs(SB)) then + if is(ret1[2]=1) then + if is(ret2[2]=1) then + ret[3]:concat(AT,"E_LU_RU") + else + (ret[3]:concat(concat(AT,"E_LU_RU")," ",ret2[3]),ret[2]:0) + else + if is(ret2[2]=1) then + (ret[3]:concat(concat(AT,"E_LU_RU")," ",ret1[3]),ret[2]:0) + else /* ret1[2]=0=ret2[2] */ + (ret[3]:concat(concat(AT,"E_LU_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else /* RHS equal, LHSs not equal */ + if is(ret1[2]=1) then + if is(ret2[2]=1) then + (ret[3]:concat(AT,"E_L",AT,"_RU"),ret[2]:1) + else + if (is(AT="I")) then + if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:1) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret2[3]),ret[2]:0) + else + if is(ret2[2]=1) then + if (is(AT="I")) then + if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:1) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RU")," ",ret1[3]," ",ret2[3]),ret[2]:0), + /* if is(ret1[2]=1) then + ret[3]:concat(AT,"E_L",AT,"_RU") + else + (ret[3]:concat(concat(AT,"E_LN",AT,"_RU")," ",ret1[3]),ret[2]:0), */ + return(ret) + ) /* RHSs not equal */ + else + if is(lhs(SA)=lhs(SB)) then block( + if is(ret1[2]=1) then + if is(ret2[2]=1) then + (ret[3]:concat(AT,"E_LU_R",AT),ret[2]:1) + else + if (is(AT="I")) then + if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) + else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:1) + else + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret2[3]),ret[2]:0) + else /* ret1[2]=0 */ + if is(ret2[2]=1) then + if (is(AT="I")) then + if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) + else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]," ",ret2[3]),ret[2]:1) + else + (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_LU_R",AT)," ",ret1[3]),ret[2]:0) + else + if (is(AT="I")) then + if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) + else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:1) + else + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]," ",ret2[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_LU_RN",AT)," ",ret1[3]),ret[2]:0), + return(ret) + ) + else + if is(ret1[2]=1) then + if (is(AT="I")) then + if (is(ret1[3]="ATInt_const") and is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else if (is(ret1[3]="ATInt_const") or is(ret2[3]="ATInt_const")) then + (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret1[3]," ",ret2[3]),ret[2]:1) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret1[3]," ",ret2[3]),ret[2]:0) + else + (ret[3]:concat(concat(AT,"E_L",AT,"_RN")," ",ret2[3]),ret[2]:0) + else block( + ret[3]:concat(concat(AT,"E_LN_R",AT)," ",ret1[3]), + ret[2]:0, + return(ret) + ) + ) + ) + ) + else block( + ret:ATEqnRet(SA,SB,var,AT), + if is(ret[2]=0) then + ret[3]:concat(concat(AT,"E_not_eqns")," ",ret[3]) + else + ret[3]:concat(AT,"E_not_eqns") + ) + ) + else ( + if not(is("AE"=AT)) then + if equationp(SA) then + ret:[false,0,concat(AT,"E_SAE_SBN"),"ATAlgEquiv_SA_not_equation"] + else + if equationp(SB) then + ret:[false,0,concat(AT,"E_SBE_SAN"),"ATAlgEquiv_TA_not_equation"] + else + ret:[false,0,concat(AT,"E_NAE_other"),""] + ), + return(ret) + )$ + + ATEqnRet(cl,ll,opt,test) := block([rt], + if is(test="I") then + rt:Intfun(cl,ll,opt) + else if is(test="D") then + rt:Difffun(cl,ll,opt) + else if is(test="PF") then + if (atom(cl) or atom(ll)) then + rt:ATAlgEquivfun(cl,ll) + else + rt:PartFracfun(cl,ll,opt) + else if is(test="FF") then + rt:FacFormfun(cl,ll,opt) + else if is(test="AE") then + rt:ATAlgEquivfun(cl,ll) + else /* Something invalid passed */ + rt:[false,0,concat("ATE_unknowntest_",test),""], /* val,rawmk,ansnote,fb */ + return(rt) + )$ + /* Description : forme echelonne par lignes d'une matrice rectangulaire |
From: Matthew B. <ba...@us...> - 2010-11-09 13:39:48
|
Update of /cvsroot/stack/stack-dev/install In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv15447/install Modified Files: Tag: grobner answer_test_testsuite.php Log Message: Code for the SysEquiv answer test. Index: answer_test_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/answer_test_testsuite.php,v retrieving revision 1.59 retrieving revision 1.59.2.1 diff -C2 -d -r1.59 -r1.59.2.1 *** answer_test_testsuite.php 8 Nov 2010 14:26:44 -0000 1.59 --- answer_test_testsuite.php 9 Nov 2010 13:39:40 -0000 1.59.2.1 *************** *** 515,518 **** --- 515,533 ---- $testsuite[] = stack_testsuite_construct('LowestTerms','3/9=x','0',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4)]','[90=v*t,90=(v+5)*(t-1/4)]',1,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[d=90,d=v*t,d=(v+5)*(t-1/4)]','[90=v*t,90=(v+5)*(t-1/4)]',1,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','1','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4)]','1',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[1]','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4)]','[1]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t^t,90=(v+5)*(t-1/4)]','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4)]','[90=v*t^t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t*x-1/4)]','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4)]','[90=v*t,90=(v+5)*(t*x-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t]','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4),90=(v+6)*(t-1/5)]','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + $testsuite[] = stack_testsuite_construct('SysEquiv','[90=v*t,90=(v+5)*(t-1/4),90=(v+6)*(t-1/5),90=(v+7)*(t-1/4),90=(v+8)*(t-1/3)]','[90=v*t,90=(v+5)*(t-1/4)]',0,'',''); + + /* Create an array with all available tests on it */ |
From: Matthew B. <ba...@us...> - 2010-11-09 13:39:48
|
Update of /cvsroot/stack/stack-dev/lib/XML/schemas In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv15447/lib/XML/schemas Modified Files: Tag: grobner stack_question.xsd stack_quiz.xsd Log Message: Code for the SysEquiv answer test. Index: stack_quiz.xsd =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/XML/schemas/stack_quiz.xsd,v retrieving revision 1.1 retrieving revision 1.1.24.1 diff -C2 -d -r1.1 -r1.1.24.1 *** stack_quiz.xsd 17 Sep 2007 16:09:08 -0000 1.1 --- stack_quiz.xsd 9 Nov 2010 13:39:40 -0000 1.1.24.1 *************** *** 378,381 **** --- 378,382 ---- <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> + <xs:enumeration value="SysEquiv" /> <xs:enumeration value="True" /> </xs:restriction> *************** *** 403,406 **** --- 404,408 ---- <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> + <xs:enumeration value="SysEquiv" /> <xs:enumeration value="True" /> </xs:restriction> *************** *** 892,895 **** --- 894,898 ---- <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> + <xs:enumeration value="SysEquiv" /> <xs:enumeration value="True" /> </xs:restriction> Index: stack_question.xsd =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/XML/schemas/stack_question.xsd,v retrieving revision 1.1 retrieving revision 1.1.24.1 diff -C2 -d -r1.1 -r1.1.24.1 *** stack_question.xsd 17 Sep 2007 16:07:51 -0000 1.1 --- stack_question.xsd 9 Nov 2010 13:39:40 -0000 1.1.24.1 *************** *** 378,381 **** --- 378,382 ---- <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> + <xs:enumeration value="SysEquiv" /> <xs:enumeration value="True" /> </xs:restriction> *************** *** 403,406 **** --- 404,408 ---- <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> + <xs:enumeration value="SysEquiv" /> <xs:enumeration value="True" /> </xs:restriction> *************** *** 892,895 **** --- 894,898 ---- <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> + <xs:enumeration value="SysEquiv" /> <xs:enumeration value="True" /> </xs:restriction> |
From: Matthew B. <ba...@us...> - 2010-11-09 13:39:48
|
Update of /cvsroot/stack/stack-dev In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv15447 Added Files: Tag: grobner .project Log Message: Code for the SysEquiv answer test. --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>stack_grobner</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription> |
From: Matthew B. <ba...@us...> - 2010-11-09 13:39:48
|
Update of /cvsroot/stack/stack-dev/lang/en In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv15447/lang/en Modified Files: Tag: grobner stack.php Log Message: Code for the SysEquiv answer test. Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lang/en/stack.php,v retrieving revision 1.160 retrieving revision 1.160.2.1 diff -C2 -d -r1.160 -r1.160.2.1 *** stack.php 2 Nov 2010 18:07:49 -0000 1.160 --- stack.php 9 Nov 2010 13:39:40 -0000 1.160.2.1 *************** *** 353,356 **** --- 353,367 ---- $string['ATNumSigFigs_Inaccurate'] = 'The accuracy of your answer is not correct. Either you have rounded correctly, or you have rounded an intermediate answer which propagates an error.'; $string['ATNumSigFigs_WrongDigits'] = 'Your answer contains the wrong number of significant digits. '; + + $string['ATSysEquiv_SA_not_list'] = 'Your answer should be a list, but it is not!'; + $string['ATSysEquiv_SB_not_list'] = 'Teacher answer is not a list'; + $string['ATSysEquiv_SA_not_eq_list'] = 'Your answer should be a list of equations, but it is not!'; + $string['ATSysEquiv_SB_not_eq_list'] = 'Teacher answer is not a list of equations'; + $string['ATSysEquiv_SA_not_poly_eq_list'] = 'One or more of your equations is not a polynomial!'; + $string['ATSysEquiv_SB_not_poly_eq_list'] = 'Teacher answer is not a list of polynomial equations'; + $string['ATSysEquiv_SA_missing_variables'] = 'Your answer is missing one or more variables!'; + $string['ATSysEquiv_SA_extra_variables'] = 'Your answer includes too many variables!'; + $string['ATSysEquiv_SA_system_underdetermined'] = 'The equations in your system appear to be correct, but you need others besides.'; + $string['ATSysEquiv_SA_system_overdetermined'] = 'The entries in red below are those that are incorrect. {$a[0]} '; |
From: Chris S. <san...@us...> - 2010-11-08 14:26:52
|
Update of /cvsroot/stack/stack-dev/install In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv24234/install Modified Files: answer_test_testsuite.php Log Message: Index: answer_test_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/answer_test_testsuite.php,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** answer_test_testsuite.php 1 Nov 2010 14:30:27 -0000 1.58 --- answer_test_testsuite.php 8 Nov 2010 14:26:44 -0000 1.59 *************** *** 83,86 **** --- 83,87 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,x>2]','[1,2<x]',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,2,[2-x<0,{1,2,2,2,1,3}]]','[1,2,[2-x<0,{1,2}]]',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x','{1,2,3}',0,'','Sets'); $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,2}','{1,2,3}',0,'',''); *************** *** 88,91 **** --- 89,93 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,2,4}','{1,2,3}',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,x>4}','{4<x,1}',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2],[2,3])',1,'','Matrices'); $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2,3],[2,3,3])',0,'',''); |
From: Chris S. <san...@us...> - 2010-11-08 14:26:47
|
Update of /cvsroot/stack/stack-dev/lib/CAS In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv24212/lib/CAS Modified Files: maximaXMLConnector.php maximaCLIConnector.php Log Message: Index: maximaXMLConnector.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/maximaXMLConnector.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** maximaXMLConnector.php 27 Aug 2009 16:23:00 -0000 1.22 --- maximaXMLConnector.php 8 Nov 2010 14:26:36 -0000 1.23 *************** *** 238,242 **** } ! $returnArray; $returnArray['key'] = (string)$this->parser->anstestresult->key; --- 238,242 ---- } ! //$returnArray; $returnArray['key'] = (string)$this->parser->anstestresult->key; Index: maximaCLIConnector.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/maximaCLIConnector.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** maximaCLIConnector.php 22 Jan 2010 11:22:08 -0000 1.41 --- maximaCLIConnector.php 8 Nov 2010 14:26:36 -0000 1.42 *************** *** 557,561 **** $trimResult = str_replace('(%o1) true','', $trimResult); - $result = $this->CASAnsTestParse($trimResult); return $result; --- 557,560 ---- |
From: Simon H. <sim...@us...> - 2010-11-08 11:09:29
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv21951/opaque/moodleModule/opaque/stack Modified Files: stackQuestionList.php Log Message: Tweak and a fix for keywords display. Index: stackQuestionList.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackQuestionList.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** stackQuestionList.php 30 Sep 2010 16:56:21 -0000 1.43 --- stackQuestionList.php 8 Nov 2010 11:09:21 -0000 1.44 *************** *** 114,117 **** --- 114,118 ---- $firstKeyword = true; //foreach($kwFreq as $kw => $freq) { + $i = 1; foreach($questionPage->keywords as $kw) { if(!$firstKeyword) { *************** *** 120,126 **** --- 121,132 ---- $kwLink = "<a href='?keywords=$kw'>$kw</a>"; echo isset($_GET['keywords']) && in_array($kw, $kws) ? "<b>$kwLink</b>": $kwLink; + if($i++ == 50) { + echo "<span onmouseover='$(this).hide();$(this).next().show()'>, <b>more...</b></span></a><span style='display:none' class='moreTags'>"; + } } if(!$firstKeyword) echo '.'; + if($i > 50) echo "</span>";// closing moretags + if (count($kwFreq) > 0) { // keywords associated with given keyword *************** *** 169,173 **** // keywords associate with given filter ! if(isset($_POST['filter'])) { echo "<p>".get_string('keywordsRelatedTo', 'qtype_opaque')." '".$_POST['filter']."': "; --- 175,179 ---- // keywords associate with given filter ! if(isset($_POST['filter']) && !empty($_POST['filter'])) { echo "<p>".get_string('keywordsRelatedTo', 'qtype_opaque')." '".$_POST['filter']."': "; |
From: Simon H. <sim...@us...> - 2010-11-08 11:09:29
|
Update of /cvsroot/stack/stack-dev In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv21951 Modified Files: styles.css Log Message: Tweak and a fix for keywords display. Index: styles.css =================================================================== RCS file: /cvsroot/stack/stack-dev/styles.css,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** styles.css 30 Sep 2010 16:56:15 -0000 1.42 --- styles.css 8 Nov 2010 11:09:21 -0000 1.43 *************** *** 27,31 **** } ! --- 27,33 ---- } ! .moreTags { ! display:none; ! } |
From: Simon H. <sim...@us...> - 2010-11-02 18:07:57
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv10214/opaque/moodleModule/opaque/stack Modified Files: stackDeploy.php stackLib.php Log Message: Polishing the deployment page, including moodle category selector. Index: stackDeploy.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackDeploy.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stackDeploy.php 1 Nov 2010 18:18:30 -0000 1.6 --- stackDeploy.php 2 Nov 2010 18:07:49 -0000 1.7 *************** *** 90,93 **** --- 90,101 ---- stackUpdateDeployment($SESSION->stackSelectedEngine, $specs); break; + + case get_string('stackDeploy_button_moveTo', 'qtype_opaque'): + $specs['id'] = $_GET['id']; // not sure this is needed but, hey. + $specs['category'] = $_POST['category']; + $specs['operation'] = 'move'; + //print_r($specs); + stackMoveDeployment($SESSION->stackSelectedEngine, $specs); + break; } } *************** *** 117,121 **** $param = $_POST + $_GET; ! $deployedPage = stackDeployedList($SESSION->stackSelectedEngine, $param); //echo '<pre>'.print_r($deployedPage, 1); --- 125,129 ---- $param = $_POST + $_GET; ! $deployedPage = stackDeployedList($SESSION->stackSelectedEngine, $param); // problem here //echo '<pre>'.print_r($deployedPage, 1); *************** *** 137,148 **** echo "<form method='POST' action='?id=".$_GET['id']."'>"; ! echo $deployedPage->xhtml; // may include form fields //echo " <input type='checkbox' name='autoprime' checked='checked'> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); //echo " <input type='checkbox' name='autoprime' ".(isset($_POST['autoprime'])?'checked="checked"':"")."> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); if($deployedList == NULL) { ! // nothing required: echo '<p>'.get_string('noInstances', 'qtype_opaque').'</p>'; } else --- 145,158 ---- echo "<form method='POST' action='?id=".$_GET['id']."'>"; ! echo "<div class='mdl-align'>".$deployedPage->xhtml."</div>"; // may include form fields //echo " <input type='checkbox' name='autoprime' checked='checked'> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); //echo " <input type='checkbox' name='autoprime' ".(isset($_POST['autoprime'])?'checked="checked"':"")."> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); + if($deployedList == NULL) { ! // nothing required: ! echo '<p class="mdl-align">'.get_string('noInstances', 'qtype_opaque').'</p>'; } else Index: stackLib.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackLib.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** stackLib.php 1 Nov 2010 18:18:30 -0000 1.21 --- stackLib.php 2 Nov 2010 18:07:49 -0000 1.22 *************** *** 533,536 **** --- 533,575 ---- } + + function stackMoveDeployment($engineID, $param) { + + $engine = load_engine_def($engineID); + if(is_string($engine)) + { + echo $engine; //error occured. + } + else + { + $connection = connect_to_engine($engine); + if (is_string($connection)) + { + echo $connection; + } + + global $USER; + $keys[] = 'userID'; + $values[] = $USER->id; + + $keys[] = 'id'; + $values[] = $param['id']; + + $passkey = stackGetPassKey($engineID, $USER->id); + + $keys[] = 'operation'; + $values[] = 'move'; + + $keys[] = 'category'; + $values[] = $param['category']; + + $keys[] = 'engineID'; + $values[] = $engineID; + + echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); + } + } + + /** * Returns the name of the engine from its id |
From: Simon H. <sim...@us...> - 2010-11-02 18:07:57
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/lang/en_utf8 In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv10214/opaque/moodleModule/opaque/lang/en_utf8 Modified Files: qtype_opaque.php Log Message: Polishing the deployment page, including moodle category selector. Index: qtype_opaque.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/lang/en_utf8/qtype_opaque.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** qtype_opaque.php 1 Nov 2010 18:18:30 -0000 1.27 --- qtype_opaque.php 2 Nov 2010 18:07:49 -0000 1.28 *************** *** 143,147 **** $string['stackDeploy_button_prime'] = 'Prime'; $string['stackDeploy_button_update'] = 'Update'; // MUST match up with $string['stackDeploy_button_update'] in stack.php ! //get_string('', 'qtype_opaque') //diagnostic --- 143,147 ---- $string['stackDeploy_button_prime'] = 'Prime'; $string['stackDeploy_button_update'] = 'Update'; // MUST match up with $string['stackDeploy_button_update'] in stack.php ! $string['stackDeploy_button_moveTo'] = 'Move to'; // MUST match up with FE_deployQuestion_moveTo in stack.php //diagnostic |
From: Simon H. <sim...@us...> - 2010-11-02 18:07:57
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv10214/opaque Modified Files: MoodleQuestionDeployment.php Log Message: Polishing the deployment page, including moodle category selector. Index: MoodleQuestionDeployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionDeployment.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MoodleQuestionDeployment.php 1 Nov 2010 18:18:30 -0000 1.6 --- MoodleQuestionDeployment.php 2 Nov 2010 18:07:49 -0000 1.7 *************** *** 127,131 **** // Handle Moodle question bank operations here if($param['operation'] == 'update') { ! $this->logger->debug("about to call hideQuestion with $stackID and engine:".$this->deployment->getEngineID()); // add new and remove old $mDB = new MoodleDB(); --- 127,131 ---- // Handle Moodle question bank operations here if($param['operation'] == 'update') { ! $this->logger->debug("about to call hideQuestion with $stackID and engine:".$this->deployment->getEngineID()); // add new and remove old $mDB = new MoodleDB(); *************** *** 135,138 **** --- 135,145 ---- $mDB->addQuestion($param['id'], $this->deployment->getLine(), $param['userID'], $this->deployment->getEngineID(), $param['category']); } + + if($param['operation'] == 'move') { + $mDB = new MoodleDB(); + $mDB->connect(); + + $mDB->addQuestion($param['id'], $this->deployment->getLine(), $param['userID'], $this->deployment->getEngineID(), $param['category']); + } } *************** *** 153,157 **** $selector = $mDB->categorySelector('category', $categories[0]); - if($currentVersion == $this->deployment->getVersion()) { // this is latest version //$earliest = $this->deployment->earliestDeployedVersion(); --- 160,163 ---- *************** *** 159,163 **** if($this->deployment->isSingleton()) $this->xhtml .= get_string('FE_deployQuestion_singletonDeployed', 'stack'); else $this->xhtml .= $this->deployment->formXHTML(); ! //$this->xhtml .= $selector; } else { // earlier version has been deployed - must drop it before we can deploy latest //$this->xhtml .= '<div class="warning">'.get_string('FE_deployQuestion_oldVersionDeployed', 'stack')."</div>"; --- 165,171 ---- if($this->deployment->isSingleton()) $this->xhtml .= get_string('FE_deployQuestion_singletonDeployed', 'stack'); else $this->xhtml .= $this->deployment->formXHTML(); ! if($this->deployment->size() > 0) { // don't want to deploy empty versions! ! $this->xhtml .= '<p /><input type="submit" name="submit" value="'.get_string('FE_deployQuestion_moveTo', 'stack').'" '.$selector; ! } } else { // earlier version has been deployed - must drop it before we can deploy latest //$this->xhtml .= '<div class="warning">'.get_string('FE_deployQuestion_oldVersionDeployed', 'stack')."</div>"; |
From: Simon H. <sim...@us...> - 2010-11-02 18:07:57
|
Update of /cvsroot/stack/stack-dev/lang/en In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv10214/lang/en Modified Files: stack.php Log Message: Polishing the deployment page, including moodle category selector. Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lang/en/stack.php,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** stack.php 1 Nov 2010 18:18:30 -0000 1.159 --- stack.php 2 Nov 2010 18:07:49 -0000 1.160 *************** *** 1169,1172 **** --- 1169,1173 ---- // Deployment strings $string['stackDeploy_button_update'] = 'Update'; // MUST match qtype_opaque + $string['FE_deployQuestion_moveTo'] = 'Move to'; // Reporting Strings |
From: Simon H. <sim...@us...> - 2010-11-01 19:27:14
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv12921/opaque Modified Files: StackServer.php MoodleQuestionDeployment.php Log Message: Stable interim commit towards deployment updating. Index: StackServer.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/StackServer.php,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** StackServer.php 7 Oct 2010 16:34:05 -0000 1.51 --- StackServer.php 1 Nov 2010 18:18:30 -0000 1.52 *************** *** 420,426 **** $param = array_combine($paramKey, $paramVal); } ! $this->logger->fine("processing deployment with param:".print_r($param, true)); $checkKey = new CheckPassKey($passKey, $userId); if ($checkKey->isValid()) { $deployment = new MoodleQuestionDeployment($passKey, $paramKey, $paramVal, $this->getHTMLHead()); $deployment->processOperations($param); --- 420,431 ---- $param = array_combine($paramKey, $paramVal); } ! $this->logger->debug("in stackDeployOperation with param:".print_r($param, true)); $checkKey = new CheckPassKey($passKey, $userId); if ($checkKey->isValid()) { + $paramKey[] = 'userID'; + $paramVal[] = $userId; + $param['userID'] = $userId; + //$paramKey[] = 'engineID'; + //$paramVal[] = ''? $deployment = new MoodleQuestionDeployment($passKey, $paramKey, $paramVal, $this->getHTMLHead()); $deployment->processOperations($param); Index: MoodleQuestionDeployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionDeployment.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MoodleQuestionDeployment.php 30 Sep 2010 16:56:21 -0000 1.5 --- MoodleQuestionDeployment.php 1 Nov 2010 18:18:30 -0000 1.6 *************** *** 103,108 **** $this->xhtml = ''; ! $this->logger->debug(print_r($this->param, 1)); ! $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } --- 103,107 ---- $this->xhtml = ''; ! $this->logger->debug("in MQD constructor: ".print_r($this->param, 1)); $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } *************** *** 125,128 **** --- 124,138 ---- } $this->deployment->processOperations($param); + + // Handle Moodle question bank operations here + if($param['operation'] == 'update') { + $this->logger->debug("about to call hideQuestion with $stackID and engine:".$this->deployment->getEngineID()); + // add new and remove old + $mDB = new MoodleDB(); + $mDB->connect(); + + $mDB->hideQuestion($param['prior'], $this->deployment->getEngineID()); + $mDB->addQuestion($param['id'], $this->deployment->getLine(), $param['userID'], $this->deployment->getEngineID(), $param['category']); + } } *************** *** 135,148 **** $currentVersion = $itemDB->getLatestVersion($this->param['id']); if($currentVersion == $this->deployment->getVersion()) { // this is latest version ! $earliest = $this->deployment->earliestDeployedVersion(); ! if($currentVersion == $earliest || false == $earliest) { if($this->deployment->isSingleton()) $this->xhtml .= get_string('FE_deployQuestion_singletonDeployed', 'stack'); else $this->xhtml .= $this->deployment->formXHTML(); ! } else { ! $this->xhtml .= get_string('FE_deployQuestion_oldVersionDeployed', 'stack'); $this->deployment = new Deployment($earliest); if($this->deployment->size() > 0) { ! $this->xhtml .= '<p><a href="?id='.$this->param['id'].'&dropall='.$earliest.'">'.get_string('FE_deployQuestion_undeployAll', 'stack').'</a>'; } } --- 145,185 ---- $currentVersion = $itemDB->getLatestVersion($this->param['id']); + $earliest = $this->deployment->earliestDeployedVersion(); + + $mDB = new MoodleDB(); + $mDB->connect(); + $categories = $mDB->getQuestionCategory($earliest); + //$this->xhtml .= print_r($categories, 1); + $selector = $mDB->categorySelector('category', $categories[0]); + + if($currentVersion == $this->deployment->getVersion()) { // this is latest version ! //$earliest = $this->deployment->earliestDeployedVersion(); ! if($currentVersion == $earliest || false == $earliest) { // no earlier deployment exists if($this->deployment->isSingleton()) $this->xhtml .= get_string('FE_deployQuestion_singletonDeployed', 'stack'); else $this->xhtml .= $this->deployment->formXHTML(); ! //$this->xhtml .= $selector; ! } else { // earlier version has been deployed - must drop it before we can deploy latest ! //$this->xhtml .= '<div class="warning">'.get_string('FE_deployQuestion_oldVersionDeployed', 'stack')."</div>"; ! $this->xhtml .= "<div class='warning'>Question $currentVersion is a newer version of question $earliest which has already been deployed into a Moodle question bank.<p>You can update the Moodle question bank in a single step with the form below.</div>"; $this->deployment = new Deployment($earliest); if($this->deployment->size() > 0) { ! //$this->xhtml .= '<p><a href="?id='.$this->param['id'].'&dropall='.$earliest.'">'.get_string('FE_deployQuestion_undeployAll', 'stack').'</a>'; ! //get_string('stackDeploy_button_update', 'qtype_opaque') ! $this->xhtml .= '<p><form action="?id='.$this->param['id'].'&dropall='.$earliest.'">'; ! $this->xhtml .= 'Remove question '.$earliest.' and deploy '.$currentVersion.' with '; ! //$this->xhtml .= ' <input type="checkbox"> Replace in Moodle question bank'; ! ! $this->xhtml .= '<input type="text" name="add" id="add" value="'.$this->deployment->size().'" size="3" maxlength="3"/> '.get_string('FE_deployQuestion_newRandomInstances', 'stack'); ! $this->xhtml .= ' into '.$selector;//'category',$mDB->getQuestionCategory($earliest)); ! /*if($mDB->attemptsOnQuestion()) { ! $this->xhtml .= "<br>Already in use in a quiz!"; ! //$this->xhtml .= '<br />Also replace in Moodle quizzes <input onclick="if(this.checked == true) alert(\'Only do this for minor changes to ensure stored student attempts are still valid!\')" type="checkbox">'; // list them and warn! ! } else $this->xhtml .= "<br>Fortunately not in use in a quiz!"; ! ! $this->xhtml .= "<br>Attempts on question: ".$mDB->attemptsOnQuestion($earliest); ! */ ! $this->xhtml .= '<br /><input type="submit" onclick="if($(\'#add\').val() == \'0\') {alert(\'zero\'); return false;}" name="submit" value="'.get_string('stackDeploy_button_update', 'stack').'">'; ! $this->xhtml .= '<input type="hidden" name="prior" value="'.$earliest.'"></form>'; } } *************** *** 165,168 **** --- 202,208 ---- } */ + + $this->xhtml .= '<h3 class="main">'.get_string('FE_deployQuestion_instancesOfQuestion', 'stack', $this->deployment->getVersion()).'</h3>'; + foreach($this->deployment->getInstances() as $instance) { $item = $this->db->getDisplayItem($instance['id']); |
From: Simon H. <sim...@us...> - 2010-11-01 18:18:38
|
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv12921/lib/items Modified Files: Item.php Log Message: Stable interim commit towards deployment updating. Index: Item.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Item.php,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Item.php 4 Oct 2010 15:00:28 -0000 1.66 --- Item.php 1 Nov 2010 18:18:30 -0000 1.67 *************** *** 570,580 **** } else $line = $this->line; ! if(!$asNew){ // just saving // check item has been changed $prior = new Item(null, $this->qID); if($this->equals($prior)) { ! $this->logger->debug('Item unchanged. No need to store!'); ! return false; } $this->logger->debug('Saving item '.$this->qID); --- 570,584 ---- } else $line = $this->line; ! $statusChangedOnly = false; if(!$asNew){ // just saving // check item has been changed $prior = new Item(null, $this->qID); if($this->equals($prior)) { ! $this->logger->debug('Item content unchanged.'); ! if($this->equalStatus($prior)) { ! return false; ! } else { ! $statusChangedOnly = true; ! } } $this->logger->debug('Saving item '.$this->qID); *************** *** 670,675 **** $meta['line'] = $this->line; - - //add to database //if (($asNew == true) || (empty($this->qID))) --- 674,677 ---- *************** *** 678,702 **** $status = $this->questionStatus->getSelection(); $published = $this->published->getSelection(); - $result = $db->addNewItem($dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); - //returned result is either qId or false if failed ! $this->qID = $result; ! $db->setLatestVersion($this->line, $this->qID); ! //add PRTs ! if(!empty($this->PRTrees)) ! { ! foreach($this->PRTrees as $PRT) ! { ! $data = $PRT->toBlob(); ! $name = $PRT->getName(); ! $prtResult = $db->addPRT($this->qID, $name, $data); ! if(!$prtResult) ! { ! $this->errorLog->addError(get_string('stackDatabase_failedAddPRT','stack','')); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddPRT','stack','')); ! } ! } } --- 680,710 ---- $status = $this->questionStatus->getSelection(); $published = $this->published->getSelection(); ! if($statusChangedOnly) { ! $result = $db->updateItem($this->qID, $dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); ! } ! else { ! $result = $db->addNewItem($dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); ! //returned result is either qId or false if failed ! $this->qID = $result; ! $db->setLatestVersion($this->line, $this->qID); ! ! //add PRTs ! if(!empty($this->PRTrees)) ! { ! foreach($this->PRTrees as $PRT) ! { ! $data = $PRT->toBlob(); ! $name = $PRT->getName(); ! $prtResult = $db->addPRT($this->qID, $name, $data); ! if(!$prtResult) ! { ! $this->errorLog->addError(get_string('stackDatabase_failedAddPRT','stack','')); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddPRT','stack','')); ! } ! } ! } } *************** *** 1332,1336 **** } */ ! // Compares user-editable attributes // Presumes whitespace has already been trimmed. public function equals($other) { --- 1340,1344 ---- } */ ! // Compares user-editable attributes, i.e. the content of the question rather than it's status (see equalStatus()) // Presumes whitespace has already been trimmed. public function equals($other) { *************** *** 1402,1410 **** // Might be nicer to update rather than create new 'valid' version of exact same question, but meanwhile... ! if($this->valid !== $other->valid) return false; return true; // all tests passed } // Compares user-editable attributes // Presumes whitespace has already been trimmed. --- 1410,1425 ---- // Might be nicer to update rather than create new 'valid' version of exact same question, but meanwhile... ! //if($this->valid !== $other->valid) return false; return true; // all tests passed } + public function equalStatus($other) { + if($this->valid !== $other->valid) return false; + if($this->published !== $other->published) return false; + + return true; + } + // Compares user-editable attributes // Presumes whitespace has already been trimmed. |