# CAS4Wiki

In this learning resource, a AppLSAC commands are loaded and processed in a Computer Algebra System (CAS). It can be used to integrate interactive exercises directly a Wikiversity learning resources. The AppLSAC is able to store and load the data into a JSON file that contains the CAS commands predefined for learners to experiment with.
       Wikiversity-CAS-App: CAS4Wiki for Wikiversity-Learning Resources in Mathematics
       Start-Link - Plot: CAS4Wiki-Start-Link with 4 Plot commands
       Start-Link - Derivatives and Gradient: Derivatives and Gradient

## Aim of the Learning Resource

This learning resource was created to accompany a lecture in which students were also required to perform interactive exercises in Computer Algebra Systems on paths in topological spaces while the learning resources are provided in Wikiversity with Wiki2Reveal slides (lecture/seminar). The workflow for CAS4Wiki together Wikiversity was designed to launch CAS4Wiki with a link from a Wikiversity learning resource. Pre-loading CAS4Wiki with a specific defined set of commands allows students to experiment with commands (i.e. changing and altering the commands to understand the theoretical background in Mathematics). FOR EXAMPLE.
* (Gradient) in calculus with the calculation of partial derivatives and the gradient, which is necessary for understanding the gradient descent method.
* (Computer Algebra System - Starter for Interactive Exercises) This learning resource helps you to create such predefined CAS4Wiki starters for specific Wikiversity learning resources in mathematics.
* (CAS4Wiki and Wiki2Reveal) The predefined CAS4Wiki launchers should be able to be launched directly from the learning resource as well as from Wiki2Reveal slides with a link to show a demo during lecture. Because Wiki2Reveal slides themselves are generated directly (on-the-fly) from a Wikiversity learning resource, you only need a link embedding in the Wikiversity learning resource itself.
* (CAS4Wiki command sequence creation) CAS4Wiki command sequences can be created as result of students exercise. These results should be saved by students from the CAS4Wiki-WebApp (format: JSON) so that these results can also be exchanged between students and lecturer as a result. This is also applicable for storing an intermediate result.
* (Wikiversity Tools) This learning resource can be used as a template for the workflow to create Wikiversity tools as AppLSACs that support authors in creating and maintaining learning resources with dynamic data.
* (JSON as a storage format for CAS4Wiki) this learning resource is a complete use case for the Application of JSON2Schema and the corresponding learning resource in Wikiversity and for a browser-only web application that can be used offline in a school network without an Internet connection. Use cases include.
** when computer algebra may be used in schools for e-exams, but no internet connection is allowed. The generated JSON is then part of the exam deliverable.
** For specific applications the CAS4Wiki could replace e.g. another open source CAS (like wxMaxima) or could be used as a mobile end-user applications with no installation required. Furthermore the WebApp can be used locally on a local area network because of the software design that needs not remote servers to perform the CAS commands.
* (CAS4wiki - Application in other Languages for Wikiversity) There are 3 main labels for predefined
   * Commands,
   * Functions and
   * Variables
    The label in the JSON editor and on buttons can be changed according to the language of the Wikiversity Learning Resource. For a german learning resource these labels and the header/title for the set of commands can be changes in CAS4Wiki Settings. Commands sets for the german Wikiversity course would change these labels e.g. to:
   * Befehle,
   * Funktionen and
   * Variablen
    These labels are stored in the JSON of the command lists. If someone exchanges a JSON e.g. with spanish labels or uses a CAS4Wiki-Startlink then also the translated labels will be changed in the CAS4Wiki editor. This assures that the Wikiversity course material and CAS4Wiki command set are presented in the same language.

## Use-Cases of Wikiversity-Tools CAS4Wiki

You can use CAS4Wiki by just starting the WebApp in your browser. No installation is required. As an AppLSAC it was designed as a support tool for mathematical learning resources in Wikiversity. The commands can be populated with a link in CAS4Wiki from Wikiversity and the learners/students can experiment with the commands to explore e.g. the plots and learn how to apply computer algebra in different other settings by executing, modifying and adapting the given commands in other applications. After going through the learning course you will be able:
* as a lecturer or teacher: to create your own set of CAS4Wiki-Commands either as a JSON-file and save the commands on your local file system. The generated file is meant to be shared among students to play with the prepared commands in CAS4Wiki. On the other hand your students could share their results among each other. Your changes to a given set of commands are not stored on a server. The commands can be executed in your browser and but can be kept, by saving your work in a local JSON file for further use. You can test the modification of commands and then reload CAS4Wiki. If you want, you can download the CAS4Wiki-Tool as ZIP-file from GitHub from the URL https://github.com/niebert/WikiversityDoc/archive/master.zip and then you will be able to start the cas4wiki.html in your browser or share the WebApp in your local area network LAN. So this allows offline work with Computer-Algebra commands with your stored JSON-file. The JSON is prepared according to the content of the corresponding Wikiversity learning ressource.
* as a student you can experiment with the given CAS4Wiki commands according to the recommendation of the corresponding Wikiversity learning resource. According to the learning activities, you may want to share your generated JSON-Datei with your teacher to show, how you solved a given learning task or learning activity among the group of students to share and discuss your resulty in the Computer Algebra System.

## Name of the AppLSAC

The AppLSAC created in this learning resource will be called CAS4Wiki because, as a web application, it is a computer algebra system (CAS) used for (4=fo(u)r=for) a wiki (Wikiversity learning resources) can be used. As AppLSAC, this encodes the command sequences as JSON file as input and is used by Wikiversity from the learning resources.

## Example for the CAS4Wiki output

With convex combinations one can represent curves in the $\mathbb {R} ^{n}$. As a visualisation example, Bernstein polynomials with binomial coefficients are considered, which represent the curve $K(t)$ in $\mathbb {R} ^{n}$ as convex combinations with vectors. The basic example here is for dealing with functions, which can then be used as a trace of the function $f:[a,b]\to \mathbb {R} ^{3}$ for using diagrams in learning resources and how to embed the diagrams with a template in a Wikiversity learning resource.
* If you have launched the AppLSAC in your browser, you can use this WebApp CAS4Wiki for updating function plots and experimenting with function terms in the Wikiversity learning resource to analyse the consequences of modifying the function term on the trace (i.e. image set of vectors in range of a function) or on the graph. You will be able to load and save the updated JSON as command sequences and also integrate these custom command sequences into a Wikiversity learning resource. The setting for the colors of the graphs and the plot sections regarding x, y and z axes can also be saved and shared in the associated JSON file, making not only the CAS4Wiki command sequences but the CAS4Wiki plots reproducible for all learners with the formatting information.
* Plots can also be exported as an image file (PNG file) in turn integrated as a graphic into a learning resource by uploading this image file to WikiCommons.
* If you would like to deal with the mathematical example topic first, you will find the topic first under Convex Combination. You will also see other options besides CAS4Wiki to provide interactive components as Geogebra files for Wikiveristy learning resources.

## Learning example

Geogebra: Interactive applet - Download:' Geogebra-File
* First look at the above video on convex combinations in the plane.
* The 3rd order convex combination can be represented with the two auxiliary points using the following Bernstein polynomial:
$K(t):=A_{1}\cdot (1-t)^{3}+3\cdot H_{1}\cdot (1-t)^{2}t+3\cdot H_{2}\cdot (1-t)t^{2}+B_{3}\cdot t^{3}$.
* We will use CAS4Wiki in this example task to transfer the above example to 4 vectors in $\mathbb {R} ^{3}$ and plot the trace in $\mathbb {R} ^{3}$.
* Start the CAS4Wiki in your browser as AppLSAC. After your first start you will find a given set of default commands of CAS4Wiki/Algebrite you can play around with. Please feel free to change any commands in the given list of commands of the given pre-defined set commands. The set of commands are defined according to the CAS Algebrite set of commands to experience the features and the command set of Algebrite that is used inside CAS4Wiki.
* Change the given set of commands in the CAS4Wiki wditor and export your modified set of commands with the SAVE-Icon on your local filesystem. You will find the download JSON as a list of your commands in your download folder of your browser with the JSON-filename commands4cas.json. This JSON file contains your modified set of commands in CAS4Wiki.
* Reload CAS4Wiki in your browser and your WebApp contain again the predefined set of commands. Your the load icon to import your saved list of commands from your download folder back into CAS4Wiki and check if your modification of the command list is restored.

## Execute CAS4Wiki Commands

The loaded CAS4Wiki commands are displayed after loading as JSON or with a CAS4Wiki-Startlink in the JSON editor. The CAS4Wiki commands are not executed after loading. If you want to execute a CAS4Wiki command select a specific command in the command list and press the Play/Execute button for the command in the command line editor .
The plot in the image uses a defined function $g(x,y)=x^{3}+y^{2}$ and plots the graph in CAS4Wiki with
The domain for the plot is defined in the arguments of the "plot3d" command with $x\in [-5,5]$ and $y\in [-3,8]$.

## CAS4Wiki Command List

The CAS4Wiki can load and save the list of commands in a JSON to exchange them between students or submit JSON to the teacher, if the students should solve a specific task in the Computer Algebra System. There are two options to share CAS4Wiki command list.
* CAS4Wiki-startlink with encoded list of commands in the URL
* JSON file with list of commands
The following section will show how to use the CAS4Wiki.

### Default Set of Demo Commands for CAS4Wiki

If your start the CAS4Wiki with the URL https://niebert.github.io/WikiversityDoc/cas4wiki.html you will get a default set of commands showing
* plot commands and
* commands for computer algebra
For specific learnings tasks in Wikiversity it makes sense to have some commands pre-populated, where the learner/student should play around with according to the learning objective. The following section shows how to use such a link in Wikiversity to use pre

### Application of Startlinks for CAS4Wiki

Use the following link to restore a predefined set commands in CAS4Wiki. The set of commands was defined for curve in $\mathbb {R} ^{3}$ loads Bernstein polynomials for a curve in $\mathbb {R} ^{3}$ which can be plotted with the CAS4Wiki by application of plotly Open Source library.
    CAS4Wiki-Link for a curve in the threedimensional vector space $\mathbb {R} ^{3}$
    $K(t)=\left({\begin{array}{c}3\\4\\5\end{array}}\right)\cdot (1-t)^{3}+\left({\begin{array}{c}5\\4\\-3\end{array}}\right)\cdot 3\cdot (1-t)^{2}\cdot t+\left({\begin{array}{c}-6\\-6\\6\end{array}}\right)\cdot 3\cdot (1-t)\cdot t^{2}+\left({\begin{array}{c}-3\\-7\\0\end{array}}\right)\cdot t^{3}$
The link contains
* 4 pre-definined vectors $v_{1},v_{2},v_{3},v_{4}$ in Variables,
* 2 pre-definined curves in $\mathbb {R} ^{3}$ with both definitions of functions/mappings $cur(t)$ and the convex combination of the Bernstein polynomials, that are defined with the following mathematical expression and
* a title for the topic - in the link above you it is "Convex Combination".
$K(t):=v_{1}\cdot (1-t)^{3}+3v_{2}\cdot (1-t)^{2}\cdot t+3v_{3}\cdot (1-t)\cdot t^{2}+v_{4}\cdot t^{3}$

### Plot Result

You can execute a given command by pressing on the Execute/Play-Button (black triangle - according to selected icon in CAS4Wiki). For the corresponding commands of plots the curves in $\mathbb {R} ^{3}$ the selected plots will appear above the command. The plots can be rotated an inspected from different perspectives to understand the spatial shape of threedimensional curve.

### Create your own Startlink for Wikiversity Learning Resource

The objective of this section is to create your own set of commands for a learning resource and generate a CAS4Wiki startlink
* Start https://niebert.github.io/WikiversityDoc/cas4wiki.html or your own instance of the CAS4Wiki at your school, college or university (e.g. your local IT infrastructure)
* If you are already used to the web-based Computer Algebra System (Algebrite) and you know the CAS-commands just add your commands to the CAS4Wiki command list and then go to the settings menu item by clicking of the Gear Icon.
* Enter the URL where you want the CAS4Wiki commands to send to (URL: https://niebert.github.io/WikiversityDoc/cas4wiki.html is predefined but you can replace that by your instance of choice)
* The settings menu can also be checked which commands are encoded in the startlink. This settings check is included in CAS4Wiki for transparency to visualize the set of commands encoded as JSON in a URL (CAS4Wiki startlink)

## JSON File for Commands

The following JSON defines the command list for a the CAS4Wiki The JSON includes
* List of commands,
* List of pre-defined functions,
* List of pre-defined variable - e.g. $v_{1},\ldots ,v_{4}\in \mathbb {R} ^{3}$ are threedimensional vectors,
* Title for the CAS4Wiki command list e.g. commands for "Convex Combination"
* Title/Label for Commands e.g. for german Wikiversity courses "Befehle" - title/label can be set for predefined functions and variables as well according to language settings (set titles in settings in CAS4Wiki)

### Background Information - Software Development for Wikiversity

* (JSON) Learn JSON as a JavaScript object notation to store and load data in CAS4Wiki.
* (JSON Editor) Learn about web-based applications (WebApps) that can be used to load, store, and modify data in a JSON data container. In this case the commands, function and predefined variables are stored in the JSON editor.
* (AppLSAC) Learn more about AppLSAC|AppLSAC web-based applications that do not require Internet connectivity and run in your browser as a runtime environment.
* (JSON Schema)' Learn more about JSON schema - see JSON-schema-step-by-step-tutorial
* (Preview of Graph) Previewing the data in the graph should be possible so that the graph can be reviewed without having to render the graph in Wikiversity or Wikipedia. OpenSource libraries in javascript need to be identified that allow rendering of the data in the graph (e.g. MorrisJS or Plotly for Javascript]).
* (Computer Algebra System - CAS) In the CAS4Wiki the Computer Algebra System "Algebrite" is used for processing the commands.