Jump to content

LabPlot/ComputationalNotebooks: Difference between revisions

From KDE Wiki Sandbox
Hmohona (talk | contribs)
add about CAS Computing
Asemke (talk | contribs)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
LabPlot can be used as a frontend to different open-source computer algebra systems (CAS) like Maxima, Octave, R, Scilab, and Sage or programming languages providing similar capabilities like Python and Julia. LabPlot recognizes different CAS variables holding array-like data and allows selecting them as a source for curves. So, instead of providing columns of a spreadsheet as the source for x- and y-data, the user provides the names of the corresponding CAS-variables. Currently supported CAS data containers are
== LabPlot/ComputationalNotebooks ==


* Maxima lists
=== Introduction ===
* Python lists, tuples and NumPy arrays
LabPlot's Computational Notebooks offer an interactive interface to various open-source mathematics and statistics packages as well as programming languages. These include Maxima, Octave, R, Scilab, Sage, KAlgebra, Qalculate!, Python, Julia, and Lua. This integration enables execution of computations and immediate visualization of results within the same environment, providing a user-friendly interface for complex calculations and data analysis.
* Julia vectors and tuples


With this, powerful calculations carried out inside of different CAS environments can be combined with the user-friendly visualization and editing capabilities of LabPlot.
Some of the key features are:
* '''Multiple Notebooks and Languages''': multiple notebooks and different languages can be used in the same project file.
* '''Extensive Editing Capabilities'''
* '''Syntax Highlighting'''
* '''Plotting Support''': the results of the visualizations are embedded directly in the notebook or shown in an external window, different output formats supported.
* '''Markdown and LaTeX Syntax''': Markdown and LaTeX syntax can be utilized within the notebooks to create richly formatted text, equations, and documentation alongside their computations and visualizations.
* '''Support for Jupyter and Cantor Projects''': LabPlot can read Jupyter and Cantor projects, allowing users to import and work with notebooks created in these environments.
* '''Integrated Help and Documentation''': LabPlot shows the output of the integrated help system for environments that provide this feature (Maxima and R) and allows to download the product documentations and to show them directly in the project.
* '''Variables as the Data Source''': LabPlot recognizes notebook variables containing array-like data (e.g., Maxima lists, Python lists and tuples, etc.) and allows to select them as sources for interactive plots and analysis functions.


See the video on how to use '''Computational Notebooks''' in LabPlot.
As a brief introduction, see the video on how to use Computational Notebooks in LabPlot.


{{#ev:youtube|8lDQStVDevw|800|center}}
{{#ev:youtube|8lDQStVDevw|800|center}}


=== Prerequisites ===
To make use of the notebook interface for a specific language, it needs to be installed first. For systems like Maxima, Octave, Sage and Scilab, the communication is happening with the executable of this system and it's enough to provide its location in the application settings if it's was not determined automatically:


<nowiki>
For R, Python and Julia the interpreter is embedded into LabPlot's process and only those versions of these languages can be used that were used on the build system during the build time of LabPlot. For which versions to use we refer to the [https://userbase.kde.org/LabPlot/FAQ#Which_version_of_Python_do_I_need_to_install_to_work_with_in_in_LabPlot? FAQ]
With this, powerful calculations carried out inside of different CAS environments can be combined with the user-friendly visualisation and editing capabilities of LabPlot. This combination is demonstrated below with the help of two examples:
</nowiki>


On Windows and on macOS (starting with LabPlot 2.12) all languages mentioned above are supported except of R, Lua, Julia and Qalculate!. On Linux, the support for the different languages is determined by the build and package step of the distribution in use.
=== Basic Concepts ===
To begin, create a new notebook from the "Add New" menu:
[[File:LabPlot notebook add new.png |500px|thumb|center]]
On default a "command entry" is created which accepts the actual code of the used language. To execute the code, hit the button "Evaluate Entry" or use the shortcut "Shift+Enter". To create cells of a different type, select the corresponding item from the context menu:
[[File:LabPlot notebook insert entry.png |500px|thumb|center]]
=== LaTeX Typesetting ===
=== Properties Panels ===
==== General ====
==== Table of Contents ====
==== Help ====
==== Variables ====
==== Documentation ====
=== Visualization in LabPlot ===
While it is possible to visualize the data directly in the notebooks for most of the supported systems, sometimes it is desired to visualize the results of computations that were performed in a notebook directly in LabPlot's [[Special:myLanguage/LabPlot/Worksheet|Worksheet]]. This is useful for example when the results need to be visualized together with other data imported into LabPlot or when the more advanced and interactive styling and navigation capabilities are required.
To enable this, LabPlot recognizes the creation of variables holding array-like data and allows to select them as a data source for plots and analysis functions similarly to the columns in a [[Special:myLanguage/LabPlot/DataContainers/Spreadsheet|Spreadsheet]]. The currently supported data containers are:
* '''Maxima''' lists
* '''Octave''' column and row vectors
* '''Python''' lists, tuples, sets, NumPy arrays, columns from Pandas dataframes
* '''Julia''' vectors and tuples
The examples below show how powerful calculations carried out inside of different environments can be combined with the user-friendly visualization and editing capabilities of LabPlot. In the first example, a Maxima session exploring the chaotic dynamics of the Duffing oscillator is shown. The forced oscillator's differential equation is solved using Maxima, and the results are visualized using LabPlot. Plots include the oscillator's trajectory, phase space, and Poincaré map, showcasing the system's complex behavior.
[[File:Labplot2 appdata 03.png|frameless|center|upright=3.0]]
[[File:Labplot2 appdata 03.png|frameless|center|upright=3.0]]
<center>
Maxima session showing the chaotic dynamics of the Duffing oscillator. The differential equation of the forced oscillator is solved with Maxima. Plots of the trajectory, the phase space of the oscillator, and the corresponding Poincaré map are done with LabPlot.
</center>


In a second example, Python session analyzing the effect of Blackman windowing on the Fourier transform is shown. It demonstrates how windowing can enhance the clarity of frequency components in signal processing, with plots showing the Fourier transform before and after applying the Blackman window.
[[File:Python session.png|frameless|center|upright=3.0]]
[[File:Python session.png|frameless|center|upright=3.0]]
<center>
Python session illustrating the effect of Blackman windowing on the Fourier transform
</center>

Latest revision as of 18:13, 24 November 2024

LabPlot/ComputationalNotebooks

Introduction

LabPlot's Computational Notebooks offer an interactive interface to various open-source mathematics and statistics packages as well as programming languages. These include Maxima, Octave, R, Scilab, Sage, KAlgebra, Qalculate!, Python, Julia, and Lua. This integration enables execution of computations and immediate visualization of results within the same environment, providing a user-friendly interface for complex calculations and data analysis.

Some of the key features are:

  • Multiple Notebooks and Languages: multiple notebooks and different languages can be used in the same project file.
  • Extensive Editing Capabilities
  • Syntax Highlighting
  • Plotting Support: the results of the visualizations are embedded directly in the notebook or shown in an external window, different output formats supported.
  • Markdown and LaTeX Syntax: Markdown and LaTeX syntax can be utilized within the notebooks to create richly formatted text, equations, and documentation alongside their computations and visualizations.
  • Support for Jupyter and Cantor Projects: LabPlot can read Jupyter and Cantor projects, allowing users to import and work with notebooks created in these environments.
  • Integrated Help and Documentation: LabPlot shows the output of the integrated help system for environments that provide this feature (Maxima and R) and allows to download the product documentations and to show them directly in the project.
  • Variables as the Data Source: LabPlot recognizes notebook variables containing array-like data (e.g., Maxima lists, Python lists and tuples, etc.) and allows to select them as sources for interactive plots and analysis functions.

As a brief introduction, see the video on how to use Computational Notebooks in LabPlot.

{{#ev:youtube|8lDQStVDevw|800|center}}

Prerequisites

To make use of the notebook interface for a specific language, it needs to be installed first. For systems like Maxima, Octave, Sage and Scilab, the communication is happening with the executable of this system and it's enough to provide its location in the application settings if it's was not determined automatically:

For R, Python and Julia the interpreter is embedded into LabPlot's process and only those versions of these languages can be used that were used on the build system during the build time of LabPlot. For which versions to use we refer to the FAQ

On Windows and on macOS (starting with LabPlot 2.12) all languages mentioned above are supported except of R, Lua, Julia and Qalculate!. On Linux, the support for the different languages is determined by the build and package step of the distribution in use.

Basic Concepts

To begin, create a new notebook from the "Add New" menu:

On default a "command entry" is created which accepts the actual code of the used language. To execute the code, hit the button "Evaluate Entry" or use the shortcut "Shift+Enter". To create cells of a different type, select the corresponding item from the context menu:

LaTeX Typesetting

Properties Panels

General

Table of Contents

Help

Variables

Documentation

Visualization in LabPlot

While it is possible to visualize the data directly in the notebooks for most of the supported systems, sometimes it is desired to visualize the results of computations that were performed in a notebook directly in LabPlot's Worksheet. This is useful for example when the results need to be visualized together with other data imported into LabPlot or when the more advanced and interactive styling and navigation capabilities are required.

To enable this, LabPlot recognizes the creation of variables holding array-like data and allows to select them as a data source for plots and analysis functions similarly to the columns in a Spreadsheet. The currently supported data containers are:

  • Maxima lists
  • Octave column and row vectors
  • Python lists, tuples, sets, NumPy arrays, columns from Pandas dataframes
  • Julia vectors and tuples

The examples below show how powerful calculations carried out inside of different environments can be combined with the user-friendly visualization and editing capabilities of LabPlot. In the first example, a Maxima session exploring the chaotic dynamics of the Duffing oscillator is shown. The forced oscillator's differential equation is solved using Maxima, and the results are visualized using LabPlot. Plots include the oscillator's trajectory, phase space, and Poincaré map, showcasing the system's complex behavior.


In a second example, Python session analyzing the effect of Blackman windowing on the Fourier transform is shown. It demonstrates how windowing can enhance the clarity of frequency components in signal processing, with plots showing the Fourier transform before and after applying the Blackman window.