From bef39f31e8e194bb3c000261fac11d2ecfe6d947 Mon Sep 17 00:00:00 2001 From: "Dr. Martin Goik" <goik@hdm-stuttgart.de> Date: Thu, 6 Sep 2018 00:13:45 +0200 Subject: [PATCH] Purging mathml related taglet --- Makefile | 2 +- P/Deps/HtmlExtensionTaglet/.gitignore | 4 - P/Deps/HtmlExtensionTaglet/pom.xml | 67 ---- .../sd1/taglet/HtmlExtensionTaglet.java | 108 ------ .../de/hdm_stuttgart/sd1/taglet/TestMe.java | 45 --- .../de/hdm_stuttgart/sd1/taglet/AppTest.java | 38 --- P/Sd1/fraction/V05/pom.xml | 123 ++++--- .../mi/sd1/fraction/Fraction.java | 75 +--- P/Sd1/fraction/V1/pom.xml | 118 +++---- .../mi/sd1/fraction/Fraction.java | 69 +--- P/Sd1/fraction/V2/pom.xml | 132 ++++---- .../mi/sd1/fraction/Fraction.java | 68 +--- P/Sd1/interest/V1/pom.xml | 117 +++---- .../mi/sd1/interest/Account.java | 63 +--- P/Sd1/interest/V2/pom.xml | 117 +++---- .../mi/sd1/interest/Account.java | 72 +--- P/Sd1/math/V1/pom.xml | 116 +++---- .../de/hdm_stuttgart/de/sd1/math/Math.java | 145 -------- .../{de => }/sd1/math/Driver.java | 2 +- .../java/de/hdm_stuttgart/sd1/math/Math.java | 49 +++ .../{de => }/sd1/math/ExpTest.java | 2 +- P/Sd1/math/V2/pom.xml | 114 +++---- .../de/hdm_stuttgart/de/sd1/math/Math.java | 298 ---------------- .../{de => }/sd1/math/Driver.java | 2 +- .../java/de/hdm_stuttgart/sd1/math/Math.java | 74 ++++ .../{de => }/sd1/math/ExpTest.java | 2 +- P/Sd1/math/V3/pom.xml | 117 +++---- .../de/hdm_stuttgart/de/sd1/math/Math.java | 316 ----------------- .../{de => }/sd1/math/Driver.java | 2 +- .../{de => }/sd1/math/LimitedPrecision.java | 2 +- .../java/de/hdm_stuttgart/sd1/math/Math.java | 93 +++++ .../{de => }/sd1/math/ExpSinSinoldTest.java | 6 +- P/Sd1/math/V4/pom.xml | 117 +++---- .../de/hdm_stuttgart/de/sd1/math/Math.java | 319 ------------------ .../{de => }/sd1/math/Driver.java | 2 +- .../java/de/hdm_stuttgart/sd1/math/Math.java | 95 ++++++ .../{de => }/sd1/math/ExpTest.java | 2 +- P/Sda1/Jdbc/Insert/MinimumTest/pom.xml | 2 +- .../inspectionProfiles/Project_Default.xml | 17 - P/Sda2/Jpa/Inherit/Tpch/pom.xml | 6 + P/pom.xml | 6 - pom.xml | 18 +- 42 files changed, 876 insertions(+), 2266 deletions(-) delete mode 100644 P/Deps/HtmlExtensionTaglet/.gitignore delete mode 100644 P/Deps/HtmlExtensionTaglet/pom.xml delete mode 100644 P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/HtmlExtensionTaglet.java delete mode 100644 P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/TestMe.java delete mode 100644 P/Deps/HtmlExtensionTaglet/src/test/java/de/hdm_stuttgart/sd1/taglet/AppTest.java delete mode 100644 P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java rename P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/{de => }/sd1/math/Driver.java (94%) create mode 100644 P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Math.java rename P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/{de => }/sd1/math/ExpTest.java (89%) delete mode 100644 P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java rename P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/{de => }/sd1/math/Driver.java (94%) create mode 100644 P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Math.java rename P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/{de => }/sd1/math/ExpTest.java (90%) delete mode 100644 P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java rename P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/{de => }/sd1/math/Driver.java (97%) rename P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/{de => }/sd1/math/LimitedPrecision.java (91%) create mode 100644 P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Math.java rename P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/{de => }/sd1/math/ExpSinSinoldTest.java (76%) delete mode 100644 P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java rename P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/{de => }/sd1/math/Driver.java (95%) create mode 100644 P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Math.java rename P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/{de => }/sd1/math/ExpTest.java (89%) delete mode 100644 P/Sda1/Lectures/Surrogate/.idea/inspectionProfiles/Project_Default.xml diff --git a/Makefile b/Makefile index d46308d44..c1167bbd8 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ DESTDIR=/var/www/html/freedocs/draft numCores=$(shell nproc --all) EXECUTABLES = /usr/share/xmlmind/bin/xxetool javac mvn rsync pdflatex convert figspecial2pdf figspecial2png figspecial2svg fig2dev fig2mpdf fig2msvg fig2pdf pdf2svg pdftoppm \ -java avconv +java ffmpeg K := $(foreach exec,$(EXECUTABLES),\ $(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH))) diff --git a/P/Deps/HtmlExtensionTaglet/.gitignore b/P/Deps/HtmlExtensionTaglet/.gitignore deleted file mode 100644 index 4e247eee2..000000000 --- a/P/Deps/HtmlExtensionTaglet/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.settings -/target -/.classpath -/.project diff --git a/P/Deps/HtmlExtensionTaglet/pom.xml b/P/Deps/HtmlExtensionTaglet/pom.xml deleted file mode 100644 index 5077d953d..000000000 --- a/P/Deps/HtmlExtensionTaglet/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - <packaging>jar</packaging> - - <name>taglet</name> - <url>http://maven.apache.org</url> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - - <distributionManagement> - <!-- This requires configurations in ~/.m2/settings.xml, see - settings.xml.template example in project root. --> - <repository> - <id>mi-maven-repository</id> - <url>scpexe://maven.mi.hdm-stuttgart.de/var/www/html/maven/artifacts</url> - </repository> - </distributionManagement> - - <dependencies> - <dependency> - <groupId>sun.jdk</groupId> - <artifactId>tools</artifactId> - <version>1.8.0</version> - <scope>system</scope> - <systemPath>${java.home}/../lib/tools.jar</systemPath> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <extensions> - <extension> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-ssh-external</artifactId> - <version>2.10</version> - </extension> - </extensions> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - - </plugins> - </build> - -</project> diff --git a/P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/HtmlExtensionTaglet.java b/P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/HtmlExtensionTaglet.java deleted file mode 100644 index 30e53d899..000000000 --- a/P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/HtmlExtensionTaglet.java +++ /dev/null @@ -1,108 +0,0 @@ -package de.hdm_stuttgart.sd1.taglet; - -import java.util.Map; - -import com.sun.javadoc.Tag; -import com.sun.tools.doclets.Taglet; - -public class HtmlExtensionTaglet implements Taglet { - - private static final String NAME = "html.extend"; - - /** - * @return the name of this custom tag. - */ - public String getName() { - return NAME; - } - - /** - * @return true since this tag can be used in a field - * doc comment - */ - public boolean inField() { - return true; - } - - /** - * @return true since this tag can be used in a constructor - * doc comment - */ - public boolean inConstructor() { - return true; - } - - /** - * @return true since this tag can be used in a method - * doc comment - */ - public boolean inMethod() { - return true; - } - - /** - * @return true since this tag can be used in an overview - * doc comment - */ - public boolean inOverview() { - return true; - } - - /** - * @return true since this tag can be used in a package - * doc comment - */ - public boolean inPackage() { - return true; - } - - /** - * @return true since this - */ - public boolean inType() { - return true; - } - - /** - * Will return true since this is an inline tag. - * @return true since this is an inline tag. - */ - - public boolean isInlineTag() { - return true; - } - - /** - * Register this Taglet. - * @param tagletMap the map to register this tag to. - */ - public static void register(Map<String, Taglet> tagletMap) { - final HtmlExtensionTaglet tag = new HtmlExtensionTaglet(); - if (null != tagletMap.get(tag.getName())) { - tagletMap.remove(tag.getName()); - } - tagletMap.put(tag.getName(), tag); - } - - /** - * Given the <code>Tag</code> representation of this custom - * tag, return its string representation. - * @param tag he <code>Tag</code> representation of this custom tag. - * - * @return The tag's textual string. - */ - public String toString(Tag tag) { - return tag.text(); - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method {@link #toString(Tag)} should be used to convert this - * inline tag to a string. - * @param tags the array of <code>Tag</code>s representing of this custom tag. - */ - public String toString(Tag[] tags) { - return null; - } - -} diff --git a/P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/TestMe.java b/P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/TestMe.java deleted file mode 100644 index 6ca7e5d79..000000000 --- a/P/Deps/HtmlExtensionTaglet/src/main/java/de/hdm_stuttgart/sd1/taglet/TestMe.java +++ /dev/null @@ -1,45 +0,0 @@ -package de.hdm_stuttgart.sd1.taglet; - -public class TestMe { - - - /** - * - * Comment will involve mathml. - * - * @return Some value according to: See down below, cannot yet be used, since taglet dep cannot - * reference itself in pom.xml, sorry! - * - */ - public String someMethod() {return "";} -} - -/* - * {@html.extend <math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mi>a</mi> - <mi>x</mi> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> - </mrow> -</math>} - */ diff --git a/P/Deps/HtmlExtensionTaglet/src/test/java/de/hdm_stuttgart/sd1/taglet/AppTest.java b/P/Deps/HtmlExtensionTaglet/src/test/java/de/hdm_stuttgart/sd1/taglet/AppTest.java deleted file mode 100644 index a756ce905..000000000 --- a/P/Deps/HtmlExtensionTaglet/src/test/java/de/hdm_stuttgart/sd1/taglet/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package de.hdm_stuttgart.sd1.taglet; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/P/Sd1/fraction/V05/pom.xml b/P/Sd1/fraction/V05/pom.xml index d261b78a5..2a5719865 100644 --- a/P/Sd1/fraction/V05/pom.xml +++ b/P/Sd1/fraction/V05/pom.xml @@ -1,75 +1,66 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>fraction-skeleton</artifactId> - <version>0.5</version> - <packaging>jar</packaging> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>fraction-skeleton</artifactId> + <version>0.5</version> + <packaging>jar</packaging> - <name>fraction-skeleton</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>fraction-skeleton</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - - </plugins> - </build> - -</project> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/P/Sd1/fraction/V05/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java b/P/Sd1/fraction/V05/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java index c02e6b486..ef2d7b05f 100644 --- a/P/Sd1/fraction/V05/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java +++ b/P/Sd1/fraction/V05/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java @@ -45,80 +45,23 @@ public class Fraction { /** * Add a second fraction to the current instance. - * + * * @param f A second fraction. - * - * @return The sum of the current instance and f according to: * -{@html.extend <math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mrow> - <mi>a</mi> - <mi>y</mi> - </mrow> - <mo>+</mo> - <mrow> - <mi>b</mi> - <mi>x</mi> - </mrow> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> -</math>} + * @return The sum of the current instance and f according to: + * \[ {a\over b} + {x\over y} = {{ay + bx}\over by} \] */ public Fraction add(Fraction f) { return null;// TODO } /** - * Multiply a second fraction by this instance - * @param f Building the product with this second fraction. + * Multiply a second fraction by this instance. + * + * @param f Building the product with this second fraction. + * * @return The result of multiplying the current instance by f according to: - {@html.extend <math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mi>a</mi> - <mi>x</mi> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> - </mrow> -</math>} - */ + * \[ {a\over b} \cdot {x\over y} = {{ax}\over by} \] + */ public Fraction mult(Fraction f) { return null;// TODO } diff --git a/P/Sd1/fraction/V1/pom.xml b/P/Sd1/fraction/V1/pom.xml index 4075e9312..a51b4515c 100644 --- a/P/Sd1/fraction/V1/pom.xml +++ b/P/Sd1/fraction/V1/pom.xml @@ -1,74 +1,66 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>fraction</artifactId> - <version>1.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>fraction</artifactId> + <version>1.0</version> - <name>fraction</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>fraction</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - - </plugins> - </build> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/P/Sd1/fraction/V1/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java b/P/Sd1/fraction/V1/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java index 226a1d6b5..165aba495 100644 --- a/P/Sd1/fraction/V1/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java +++ b/P/Sd1/fraction/V1/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java @@ -51,76 +51,19 @@ public class Fraction { * @param f A second fraction. * * @return The sum of the current instance and f according to: - * -{@html.extend <math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mrow> - <mi>a</mi> - <mi>y</mi> - </mrow> - <mo>+</mo> - <mrow> - <mi>b</mi> - <mi>x</mi> - </mrow> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> -</math>} + * \[ {a\over b} + {x\over y} = {{ay + bx}\over by} \] */ public Fraction add(Fraction f) { return new Fraction( numerator * f.denominator + denominator * f.numerator, denominator * f.denominator); } /** - * Multiply a second fraction by this instance - * @param f Building the product with this second fraction. + * Multiply a second fraction by this instance. + * + * @param f Building the product with this second fraction. + * * @return The result of multiplying the current instance by f according to: - {@html.extend <math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mi>a</mi> - <mi>x</mi> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> - </mrow> -</math>} + * \[ {a\over b} \cdot {x\over y} = {{ax}\over by} \] */ public Fraction mult(Fraction f) { return new Fraction(numerator * f.numerator, diff --git a/P/Sd1/fraction/V2/pom.xml b/P/Sd1/fraction/V2/pom.xml index c31228a1b..3899cde59 100644 --- a/P/Sd1/fraction/V2/pom.xml +++ b/P/Sd1/fraction/V2/pom.xml @@ -1,80 +1,72 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>fraction</artifactId> - <version>2.0</version> - <packaging>jar</packaging> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>fraction</artifactId> + <version>2.0</version> + <packaging>jar</packaging> - <name>fraction</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>fraction</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>gcd</artifactId> - <version>1.0</version> - </dependency> + <dependencies> + <dependency> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>gcd</artifactId> + <version>1.0</version> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - - </plugins> - </build> - -</project> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/P/Sd1/fraction/V2/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java b/P/Sd1/fraction/V2/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java index 4f49d34e1..49c1c34bc 100644 --- a/P/Sd1/fraction/V2/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java +++ b/P/Sd1/fraction/V2/src/main/java/de/hdm_stuttgart/mi/sd1/fraction/Fraction.java @@ -60,40 +60,7 @@ public class Fraction { * @param f A second fraction. * * @return The sum of the current instance and f according to: - * -{@html.extend <math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mrow> - <mi>a</mi> - <mi>y</mi> - </mrow> - <mo>+</mo> - <mrow> - <mi>b</mi> - <mi>x</mi> - </mrow> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> -</math>} + * \[ {a\over b} + {x\over y} = {{ay + bx}\over by} \] */ public Fraction add(Fraction f) { @@ -104,36 +71,11 @@ public class Fraction { } /** * Multiply a second fraction by this instance - * @param f Building the product with this second fraction. + * @param f Building the product with this second fraction. + * * @return The result of multiplying the current instance by f according to: - {@html.extend <math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mrow> - <mrow> - <mfrac> - <mi>a</mi> - <mi>b</mi> - </mfrac> - <mfrac> - <mi>x</mi> - <mi>y</mi> - </mfrac> - </mrow> - <mo>=</mo> - <mfrac> - <mrow> - <mi>a</mi> - <mi>x</mi> - </mrow> - <mrow> - <mi>b</mi> - <mi>y</mi> - </mrow> - </mfrac> - </mrow> - </mrow> -</math>} - */ + * \[ {a\over b} \cdot {x\over y} = {{ax}\over by} \] + */ public Fraction mult(Fraction f) { final Fraction f1 = new Fraction(f.numerator, denominator), f2 = new Fraction(numerator, f.denominator); diff --git a/P/Sd1/interest/V1/pom.xml b/P/Sd1/interest/V1/pom.xml index 81452cb01..901564004 100644 --- a/P/Sd1/interest/V1/pom.xml +++ b/P/Sd1/interest/V1/pom.xml @@ -1,72 +1,65 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>interest</artifactId> - <version>1.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>interest</artifactId> + <version>1.0</version> - <name>interest_V1</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>interest_V1</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> - </build> - -</project> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/P/Sd1/interest/V1/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java b/P/Sd1/interest/V1/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java index 838596123..a4f9c95be 100644 --- a/P/Sd1/interest/V1/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java +++ b/P/Sd1/interest/V1/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java @@ -67,31 +67,8 @@ public class Account { } /** * <p>Adding the annual interest to the current balance according to:</p> - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msub> - <mi>balance</mi> - <mi>1</mi> - </msub> - <mo>=</mo> - <mrow> - <mi>balance</mi> - <mrow> - <mo>(</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <mi>interestRate</mi> - <mi>100</mi> - </mfrac> - </mrow> - <mo>)</mo> - </mrow> - </mrow> - </mrow> - </math>} + * + * \[ balance_{1} = balance (1 + {interestRate\over 100}) \] */ public void applyInterest() { balance = balance * (1 + interestRate / 100); @@ -99,37 +76,10 @@ public class Account { /** * <p>Adding the interest of several years to the current balance according to:</p> - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msub> - <mi>balance</mi> - <mi>years</mi> - </msub> - <mo>=</mo> - <mrow> - <mi>balance</mi> - <msup> - <mrow> - <mo>(</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <mi>interestRate</mi> - <mi>100</mi> - </mfrac> - </mrow> - <mo>)</mo> - </mrow> - <mi>years</mi> - </msup> - </mrow> - </mrow> - </math>} * - * @param years - * the given time period. + * \[ balance_{years} = balance\ {\left(1 + {interestRate\over 100}\right)}^{years} \] + * + * @param years the given time period. */ public void applyInterest(int years) { balance = balance * Math.pow((1 + interestRate / 100), years) ; // interest factor raised to the power of years, see javadoc. @@ -138,8 +88,7 @@ public class Account { /** * Calculate the expected annual interest without changing the account's balance. * - * @return - * Annual interest to be expected + * @return Annual interest to be expected */ public double getYearlyInterest() { return balance * interestRate / 100; diff --git a/P/Sd1/interest/V2/pom.xml b/P/Sd1/interest/V2/pom.xml index 9e322d1b5..945a09b59 100644 --- a/P/Sd1/interest/V2/pom.xml +++ b/P/Sd1/interest/V2/pom.xml @@ -1,72 +1,65 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>interest</artifactId> - <version>2.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>interest</artifactId> + <version>2.0</version> - <name>interest_V2</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>interest_V2</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> - </build> - -</project> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/P/Sd1/interest/V2/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java b/P/Sd1/interest/V2/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java index abddf847a..836ebed10 100644 --- a/P/Sd1/interest/V2/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java +++ b/P/Sd1/interest/V2/src/main/java/de/hdm_stuttgart/mi/sd1/interest/Account.java @@ -23,8 +23,7 @@ public class Account { /** * Create a new account having of given initial balance. * - * @param balance - * The account's initial balance. + * @param balance The account's initial balance. */ public Account(double balance) { // Non-default constructor creating an account setBalance(balance); // with (possibly) non-zero balance. @@ -89,33 +88,12 @@ public class Account { /** * <p>Adding the annual interest to the current balance according to:</p> - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msub> - <mi>balance</mi> - <mi>1</mi> - </msub> - <mo>=</mo> - <mrow> - <mi>balance</mi> - <mrow> - <mo>(</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <mi>interestRate</mi> - <mi>100</mi> - </mfrac> - </mrow> - <mo>)</mo> - </mrow> - </mrow> - </mrow> - </math>} - * <p>Positive balances will receive the value of {{@link #setInterestRate(double)} whereas the + * + * \[ balance_{1} = balance (1 + {interestRate\over 100}) \] + * + *<p>Positive balances will receive the value of {@link #setInterestRate(double)} whereas the * calculation of negative balances will be based on {{@link #setDefaultInterestRate(double)}.</p> + * */ public void applyInterest() { if (0 < balance) { @@ -127,40 +105,13 @@ public class Account { /** * <p>Adding the interest of several years to the current balance according to:</p> - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msub> - <mi>balance</mi> - <mi>years</mi> - </msub> - <mo>=</mo> - <mrow> - <mi>balance</mi> - <msup> - <mrow> - <mo>(</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <mi>interestRate</mi> - <mi>100</mi> - </mfrac> - </mrow> - <mo>)</mo> - </mrow> - <mi>years</mi> - </msup> - </mrow> - </mrow> - </math>} * - *<p>Positive balances will receive the value of {{@link #setInterestRate(double)} whereas the + * \[ balance_{years} = balance\ {\left(1 + {interestRate\over 100}\right)}^{years} \] + * + *<p>Positive balances will receive the value of {@link #setInterestRate(double)} whereas * calculation of negative balances will be based on {{@link #setDefaultInterestRate(double)}.</p> * - * @param years - * the given time period. + * @param years the given time period. */ public void applyInterest(int years) { if (0 < balance) { @@ -173,8 +124,7 @@ public class Account { /** * Calculate the expected annual interest without changing the account's balance. * - * @return - * Annual interest to be expected + * @return Annual interest to be expected */ public double getYearlyInterest() { return balance * interestRate / 100; diff --git a/P/Sd1/math/V1/pom.xml b/P/Sd1/math/V1/pom.xml index 6116f9926..1af37f366 100644 --- a/P/Sd1/math/V1/pom.xml +++ b/P/Sd1/math/V1/pom.xml @@ -1,73 +1,67 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>math</artifactId> - <version>1.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>math</artifactId> + <version>1.0</version> - <name>math_v1</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>math_v1</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.9</source> + <target>1.9</target> + </configuration> + </plugin> + + </plugins> + </build> - </plugins> - </build> - </project> diff --git a/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java b/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java deleted file mode 100644 index 0c829cd23..000000000 --- a/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java +++ /dev/null @@ -1,145 +0,0 @@ -package de.hdm_stuttgart.de.sd1.math; - -/** - * <p>This class implements a subset of functions from class - * {@link java.lang.Math} using power series expansions.</p> - * - */ -public class Math { - - static int seriesLimit = 5; - - /** - * - * @param seriesLimit The last term's index of a power series to be included. - * - */ - public static void setSeriesLimit(int seriesLimit) { - Math.seriesLimit = seriesLimit; - } - - /** - * <p>Approximating the natural exponential function by a finite - * number of terms using power series expansion.</p> - * - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - <mo>=</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>1</mi> - </msup> - <mi>1!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>2</mi> - </msup> - <mi>2!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mi>3!</mi> - </mfrac> - <mo>+</mo> - <mn>...</mn> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>seriesLimit</mi> - </msup> - <mrow> - <mi>seriesLimit</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi mathvariant="normal">seriesLimit</mi> - </munderover> - <mfrac> - <msup> - <mi>x</mi> - <mi>i</mi> - </msup> - <mrow> - <mi>i</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * A power series implementation has to be finite since an - * infinite number of terms requires infinite execution time. - * - * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} - * - * @param x The exponential's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} - - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} itself. - */ - public static double exp(double x) { - double currentTerm = 1., // the first (i == 0) term x^0/0! - sum = currentTerm; // initialize to the power series' first term - - for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. - currentTerm *= x / i; - sum += currentTerm; - } - return sum; - } -} diff --git a/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java b/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java similarity index 94% rename from P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java rename to P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java index f6be81c32..b60412e6a 100644 --- a/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java +++ b/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; /** * Testing {@link Math#exp(double)}in diff --git a/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Math.java b/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Math.java new file mode 100644 index 000000000..3847a368e --- /dev/null +++ b/P/Sd1/math/V1/src/main/java/de/hdm_stuttgart/sd1/math/Math.java @@ -0,0 +1,49 @@ +package de.hdm_stuttgart.sd1.math; + +/** + * <p>This class implements a subset of functions from class + * {@link java.lang.Math} using power series expansions.</p> + * + */ +public class Math { + + static int seriesLimit = 5; + + /** + * + * @param seriesLimit The last term's index of a power series to be included. + * + */ + public static void setSeriesLimit(int seriesLimit) { + Math.seriesLimit = seriesLimit; + } + + /** + * <p>Approximating the natural exponential function by a finite + * number of terms using power series expansion.</p> + * + * \[ \begin{aligned} + * e^x ={} & 1 + {x\over 1!} + {x^2\over 2!} + {x^3\over 3!} + \dots \\ + * ={} & \sum_{i = 0}^\infty {x^i\over i!} + * \end{aligned} \] + * + * A power series implementation has to be finite since an + * infinite number of terms requires infinite execution time. + * + * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} + * + * @param x The exponential's argument as in \( e^x \) + + * @return The value \( e^x \) itself. + */ + public static double exp(double x) { + double currentTerm = 1., // the first (i == 0) term x^0/0! + sum = currentTerm; // initialize to the power series' first term + + for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. + currentTerm *= x / i; + sum += currentTerm; + } + return sum; + } +} \ No newline at end of file diff --git a/P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java b/P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java similarity index 89% rename from P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java rename to P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java index 6a2572c7f..438949f1e 100644 --- a/P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java +++ b/P/Sd1/math/V1/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; import static org.junit.Assert.*; diff --git a/P/Sd1/math/V2/pom.xml b/P/Sd1/math/V2/pom.xml index ae4b4ad83..1aae1daed 100644 --- a/P/Sd1/math/V2/pom.xml +++ b/P/Sd1/math/V2/pom.xml @@ -1,73 +1,67 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>math</artifactId> - <version>2.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>math</artifactId> + <version>2.0</version> - <name>math_v2</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>math_v2</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> - </plugins> - </build> + </plugins> + </build> </project> diff --git a/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java b/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java deleted file mode 100644 index cc3de52fa..000000000 --- a/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java +++ /dev/null @@ -1,298 +0,0 @@ -package de.hdm_stuttgart.de.sd1.math; - -/** - * <p>This class implements a subset of functions from class - * {@link java.lang.Math} using power series expansions.</p> - * - */ -public class Math { - - static int seriesLimit = 5; - - /** - * - * @param seriesLimit The number of terms of a power series to be included. - * - */ - public static void setSeriesLimit(int seriesLimit) { - Math.seriesLimit = seriesLimit; - } - - /** - * <p>Approximating the natural exponential function by a finite - * number of terms from the corresponding power series expansion</p> - * - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - <mo>=</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>1</mi> - </msup> - <mi>1!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>2</mi> - </msup> - <mi>2!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mi>3!</mi> - </mfrac> - <mo>+</mo> - <mn>...</mn> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>seriesLimit</mi> - </msup> - <mrow> - <mi>seriesLimit</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi>seriesLimit</mi> - </munderover> - <mfrac> - <msup> - <mi>x</mi> - <mi>i</mi> - </msup> - <mrow> - <mi>i</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * A power series implementation has to be finite since an - * infinite number of terms requires infinite execution time. - * - * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} - * - * @param x The exponential's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} - - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} itself. - */ - public static double exp(double x) { - double currentTerm = 1., // the first (i == 0) term x^0/0! - sum = currentTerm; // initialize to the power series' first term - - for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. - currentTerm *= x / i; - sum += currentTerm; - } - return sum; - } - - /** - * <p>Calculating the sine by means of the corresponding power series.</p> - * - {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> - <mo>=</mo> - <mrow> - <mi>x</mi> - <mo>-</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mrow> - <mi>3</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>5</mi> - </msup> - <mrow> - <mi>5</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>-</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>7</mi> - </msup> - <mrow> - <mi>7</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>+</mo> - <mi>...</mi> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi>seriesLimit</mi> - </munderover> - <mrow> - <msup> - <mrow> - <mo>(</mo> - <mi>-1</mi> - <mo>)</mo> - </mrow> - <mrow> - <mi>2</mi> - <mi>i</mi> - </mrow> - </msup> - <mfrac> - <msup> - <mi>x</mi> - <mrow> - <mi>2</mi> - <mo>i</mo> - <mo>+</mo> - <mi>1</mi> - </mrow> - </msup> - <mrow> - <mrow> - <mo>(</mo> - <mi>2</mi> - <mi>i</mi> - <mo>+</mo> - <mi>1</mi> - <mo>)</mo> - </mrow> - <mo>!</mo> - </mrow> - </mfrac> - </mrow> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * @param x The sine's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> -</math>} - * - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> -</math>} itself. -*/ - public static double sin(double x) { - double currentTerm = x, // the first (i == 0) term x^1/1! - sum = currentTerm; // initialize to the power series' first term - - for (int i = 1; i <= seriesLimit; i++) { - currentTerm *= -1 * x * x / (2 * i) / (2 * i + 1); - sum += currentTerm; - } - return sum; - } -} diff --git a/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java b/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java similarity index 94% rename from P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java rename to P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java index 856beb072..a0600de65 100644 --- a/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java +++ b/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; /** * Testing {@link Math#sin(double)}in diff --git a/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Math.java b/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Math.java new file mode 100644 index 000000000..d461cb963 --- /dev/null +++ b/P/Sd1/math/V2/src/main/java/de/hdm_stuttgart/sd1/math/Math.java @@ -0,0 +1,74 @@ +package de.hdm_stuttgart.sd1.math; + +/** + * <p>This class implements a subset of functions from class + * {@link java.lang.Math} using power series expansions.</p> + * + */ +public class Math { + + static int seriesLimit = 5; + + /** + * + * @param seriesLimit The number of terms of a power series to be included. + * + */ + public static void setSeriesLimit(int seriesLimit) { + Math.seriesLimit = seriesLimit; + } + + /** + * <p>Approximating the natural exponential function by a finite + * number of terms from the corresponding power series expansion</p> + * + * \[ \begin{aligned} + * e^x ={} & 1 + {x\over 1!} + {x^2\over 2!} + {x^3\over 3!} + \dots \\ + * ={} & \sum_{i = 0}^\infty {x^i\over i!} + * \end{aligned} \] + * + * A power series implementation has to be finite since an + * infinite number of terms requires infinite execution time. + * + * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} + * + * @param x The exponential's argument as in \( e^x \) + + * @return The value \( e^x \) itself. + */ + public static double exp(double x) { + double currentTerm = 1., // the first (i == 0) term x^0/0! + sum = currentTerm; // initialize to the power series' first term + + for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. + currentTerm *= x / i; + sum += currentTerm; + } + return sum; + } + + /** + * <p>Calculating the sine by means of the corresponding power series.</p> + * + \[ + \begin{aligned} + \text{sin}(x) ={} & x - {x^3\over 3!} + {x^5\over 5!} - {x^7\over 7!} + \dots \\ + ={} & \sum_{i = 0}^\infty {(-1)^i {x^{2i+1}\over (2i+1)!}} + \end{aligned} + \] + * + * @param x The sine's argument as in \( \text{sin}(x) \). + * + * @return The value \( \text{sin}(x) \) itself. +*/ + public static double sin(double x) { + double currentTerm = x, // the first (i == 0) term x^1/1! + sum = currentTerm; // initialize to the power series' first term + + for (int i = 1; i <= seriesLimit; i++) { + currentTerm *= -1 * x * x / (2 * i) / (2 * i + 1); + sum += currentTerm; + } + return sum; + } +} \ No newline at end of file diff --git a/P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java b/P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java similarity index 90% rename from P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java rename to P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java index bac0201f9..57f38bca7 100644 --- a/P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java +++ b/P/Sd1/math/V2/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; import static org.junit.Assert.*; diff --git a/P/Sd1/math/V3/pom.xml b/P/Sd1/math/V3/pom.xml index 258a877c5..2765e5be9 100644 --- a/P/Sd1/math/V3/pom.xml +++ b/P/Sd1/math/V3/pom.xml @@ -1,73 +1,66 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>math</artifactId> - <version>3.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>math</artifactId> + <version>3.0</version> - <name>math_v3</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>math_v3</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> - </plugins> - </build> - -</project> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java deleted file mode 100644 index fc7419c2d..000000000 --- a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java +++ /dev/null @@ -1,316 +0,0 @@ -package de.hdm_stuttgart.de.sd1.math; - -/** - * <p>This class implements a subset of functions from class - * {@link java.lang.Math} using power series expansions.</p> - * - */ -public class Math { - - static int seriesLimit = 5; - - /** - * - * @param seriesLimit The number of terms of a power series to be included. - * - */ - public static void setSeriesLimit(int seriesLimit) { - Math.seriesLimit = seriesLimit; - } - - /** - * <p>Approximating the natural exponential function by a finite - * number of terms using power series expansion.</p> - * - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - <mo>=</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>1</mi> - </msup> - <mi>1!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>2</mi> - </msup> - <mi>2!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mi>3!</mi> - </mfrac> - <mo>+</mo> - <mn>...</mn> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>seriesLimit</mi> - </msup> - <mrow> - <mi>seriesLimit</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi>seriesLimit</mi> - </munderover> - <mfrac> - <msup> - <mi>x</mi> - <mi>i</mi> - </msup> - <mrow> - <mi>i</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * A power series implementation has to be finite since an - * infinite number of terms requires infinite execution time. - * - * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} - * - * @param x The exponential's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} - - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} itself. - */ - public static double exp(double x) { - double currentTerm = 1., // the first (i == 0) term x^0/0! - sum = currentTerm; // initialize to the power series' first term - - for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. - currentTerm *= x / i; - sum += currentTerm; - } - return sum; - } - - /** - * <p>Calculating the sine by means of the corresponding power series.</p> - {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> - <mo>=</mo> - <mrow> - <mi>x</mi> - <mo>-</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mrow> - <mi>3</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>5</mi> - </msup> - <mrow> - <mi>5</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>-</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>7</mi> - </msup> - <mrow> - <mi>7</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>+</mo> - <mi>...</mi> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi>seriesLimit</mi> - </munderover> - <mrow> - <msup> - <mrow> - <mo>(</mo> - <mi>-1</mi> - <mo>)</mo> - </mrow> - <mrow> - <mi>2</mi> - <mi>i</mi> - </mrow> - </msup> - <mfrac> - <msup> - <mi>x</mi> - <mrow> - <mi>2</mi> - <mo>i</mo> - <mo>+</mo> - <mi>1</mi> - </mrow> - </msup> - <mrow> - <mrow> - <mo>(</mo> - <mi>2</mi> - <mi>i</mi> - <mo>+</mo> - <mi>1</mi> - <mo>)</mo> - </mrow> - <mo>!</mo> - </mrow> - </mfrac> - </mrow> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * @param x The sine's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> -</math>} - * - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> -</math>} itself. -*/ - public static double sinOld(double x) { - double currentTerm = x, // the first (i == 0) term x^1/1! - sum = currentTerm; // initialize to the power series' first term - - for (int i = 1; i <= seriesLimit; i++) { - currentTerm *= -1 * x * x / (2 * i) / (2 * i + 1); - sum += currentTerm; - } - return sum; - } - /** - * Implementing sine slightly different by reordering terms. - * @param x See {@link #sinOld(double)}} - * @return See {@link #sinOld(double)}} - * - */ - public static double sin(double x) { - double currentTerm = x, // the first (i == 0) term x^1/1! - sum = currentTerm; // initialize to the power series' first term - - // Slightly incorrect if seriesLimit is even - for (int i = 1; i <= seriesLimit; i += 2) { // Caution: Steps of two!! - final double previousTerm = // save the current term - currentTerm *= x * x / (2 * i) / (2 * i + 1) ; - currentTerm *= x * x / (2 * i + 2) / (2 * i + 3); - sum += currentTerm - previousTerm; //Summing up reordered - } - return sum; - } -} diff --git a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java similarity index 97% rename from P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java rename to P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java index 1c11b947f..9f06ebbd4 100644 --- a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java +++ b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; /** * Testing {@link Math#sinOld(double)}in diff --git a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/LimitedPrecision.java b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/LimitedPrecision.java similarity index 91% rename from P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/LimitedPrecision.java rename to P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/LimitedPrecision.java index ed2b420c5..6c403fda1 100644 --- a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/de/sd1/math/LimitedPrecision.java +++ b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/LimitedPrecision.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; /** * Demonstrating limited precision problems diff --git a/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Math.java b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Math.java new file mode 100644 index 000000000..78cbb014c --- /dev/null +++ b/P/Sd1/math/V3/src/main/java/de/hdm_stuttgart/sd1/math/Math.java @@ -0,0 +1,93 @@ +package de.hdm_stuttgart.sd1.math; + +/** + * <p>This class implements a subset of functions from class + * {@link java.lang.Math} using power series expansions.</p> + * + */ +public class Math { + + static int seriesLimit = 5; + + /** + * + * @param seriesLimit The number of terms of a power series to be included. + * + */ + public static void setSeriesLimit(int seriesLimit) { + Math.seriesLimit = seriesLimit; + } + + /** + * <p>Approximating the natural exponential function by a finite + * number of terms using power series expansion.</p> + * + * \[ \begin{aligned} + * e^x ={} & 1 + {x\over 1!} + {x^2\over 2!} + {x^3\over 3!} + \dots \\ + * ={} & \sum_{i = 0}^\infty {x^i\over i!} + * \end{aligned} \] + * + * A power series implementation has to be finite since an + * infinite number of terms requires infinite execution time. + * + * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} + * + * @param x The exponential's argument as in \( e^x \) + + * @return The value \( e^x \) itself. + */ + public static double exp(double x) { + double currentTerm = 1., // the first (i == 0) term x^0/0! + sum = currentTerm; // initialize to the power series' first term + + for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. + currentTerm *= x / i; + sum += currentTerm; + } + return sum; + } + + /** + * <p>Calculating the sine by means of the corresponding power series.</p> + * + \[ + \begin{aligned} + \text{sin}(x) ={} & x - {x^3\over 3!} + {x^5\over 5!} - {x^7\over 7!} + \dots \\ + ={} & \sum_{i = 0}^\infty {(-1)^i {x^{2i+1}\over (2i+1)!}} + \end{aligned} + \] + * + * @param x The sine's argument as in \( \text{sin}(x) \). + * + * @return The value \( \text{sin}(x) \) itself. + */ + public static double sinOld(double x) { + double currentTerm = x, // the first (i == 0) term x^1/1! + sum = currentTerm; // initialize to the power series' first term + + for (int i = 1; i <= seriesLimit; i++) { + currentTerm *= -1 * x * x / (2 * i) / (2 * i + 1); + sum += currentTerm; + } + return sum; + } + /** + * Implementing sine slightly different by reordering terms. + * @param x See {@link #sinOld(double)}} + * @return See {@link #sinOld(double)}} + * + */ + public static double sin(double x) { + double currentTerm = x, // the first (i == 0) term x^1/1! + sum = currentTerm; // initialize to the power series' first term + + // Slightly incorrect if seriesLimit is even + for (int i = 1; i <= seriesLimit; i += 2) { // Caution: Steps of two!! + final double previousTerm = // save the current term + currentTerm *= x * x / (2 * i) / (2 * i + 1) ; + currentTerm *= x * x / (2 * i + 2) / (2 * i + 3); + sum += currentTerm - previousTerm; //Summing up reordered + } + return sum; + } +} diff --git a/P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpSinSinoldTest.java b/P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/sd1/math/ExpSinSinoldTest.java similarity index 76% rename from P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpSinSinoldTest.java rename to P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/sd1/math/ExpSinSinoldTest.java index baf3977a5..ca27825b6 100644 --- a/P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpSinSinoldTest.java +++ b/P/Sd1/math/V3/src/test/java/de/hdm_stuttgart/sd1/math/ExpSinSinoldTest.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; import static org.junit.Assert.*; @@ -20,9 +20,9 @@ public class ExpSinSinoldTest { Math.exp(1) - java.lang.Math.E) < 1.E-6); assertTrue(java.lang.Math.abs( - Math.sin(java.lang.Math.PI)) < 1.E-10); + Math.sin(java.lang.Math.PI)) < 1.E-10); assertFalse(java.lang.Math.abs( // Lower precision - Math.sinOld(java.lang.Math.PI)) < 1.E-10); + Math.sinOld(java.lang.Math.PI)) < 1.E-10); } } diff --git a/P/Sd1/math/V4/pom.xml b/P/Sd1/math/V4/pom.xml index 9715441df..52c32c4d6 100644 --- a/P/Sd1/math/V4/pom.xml +++ b/P/Sd1/math/V4/pom.xml @@ -1,73 +1,66 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>math</artifactId> - <version>4.0</version> + <groupId>de.hdm-stuttgart.sd1</groupId> + <artifactId>math</artifactId> + <version>4.0</version> - <name>math_v4</name> - <url>https://freedocs.mi.hdm-stuttgart.de</url> + <name>math_v4</name> + <url>https://freedocs.mi.hdm-stuttgart.de</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <repositories> - <repository> - <id>hdm-mi-internal-maven-repo</id> - <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> - </repository> - </repositories> + <repositories> + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/artifacts</url> + </repository> + </repositories> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.9.1</version> - </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.9.1</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <linksource>true</linksource> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> - </plugins> - </build> - -</project> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java b/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java deleted file mode 100644 index f38cafe35..000000000 --- a/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Math.java +++ /dev/null @@ -1,319 +0,0 @@ -package de.hdm_stuttgart.de.sd1.math; - -/** - * <p>This class implements a subset of functions from class - * {@link java.lang.Math} using power series expansions.</p> - * - */ -public class Math { - - private static final double PI = java.lang.Math.PI; - - static int seriesLimit = 5; - - /** - * - * @param seriesLimit The number of terms of a power series to be included. - * - */ - public static void setSeriesLimit(int seriesLimit) { - Math.seriesLimit = seriesLimit; - } - - /** - * <p>Approximating the natural exponential function by a finite - * number of terms from the corresponding power series expansion.</p> - * - * {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - <mo>=</mo> - <mrow> - <mi>1</mi> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>1</mi> - </msup> - <mi>1!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>2</mi> - </msup> - <mi>2!</mi> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mi>3!</mi> - </mfrac> - <mo>+</mo> - <mn>...</mn> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>seriesLimit</mi> - </msup> - <mrow> - <mi>seriesLimit</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi>seriesLimit</mi> - </munderover> - <mfrac> - <msup> - <mi>x</mi> - <mi>i</mi> - </msup> - <mrow> - <mi>i</mi> - <mi>!</mi> - </mrow> - </mfrac> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * A power series implementation has to be finite since an - * infinite number of terms requires infinite execution time. - * - * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} - * - * @param x The exponential's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} - - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <msup> - <mi>e</mi> - <mi>x</mi> - </msup> - </mrow> -</math>} itself. - */ - public static double exp(double x) { - double currentTerm = 1., // the first (i == 0) term x^0/0! - sum = currentTerm; // initialize to the power series' first term - - for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. - currentTerm *= x / i; - sum += currentTerm; - } - return sum; - } - - /** - * <p>Calculating the sine by means of the corresponding power series.</p> - * - {@html.extend -<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"> - <mtable> - <mtr> - <mtd> - <mrow> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> - <mo>=</mo> - <mrow> - <mi>x</mi> - <mo>-</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>3</mi> - </msup> - <mrow> - <mi>3</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>+</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>5</mi> - </msup> - <mrow> - <mi>5</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>-</mo> - <mfrac> - <msup> - <mi>x</mi> - <mi>7</mi> - </msup> - <mrow> - <mi>7</mi> - <mo>!</mo> - </mrow> - </mfrac> - <mo>+</mo> - <mi>...</mi> - </mrow> - </mrow> - </mtd> - </mtr> - <mtr> - <mtd> - <mrow> - <mo>=</mo> - <mrow> - <munderover> - <mo>∑</mo> - <mrow> - <mi>i</mi> - <mo>=</mo> - <mi>0</mi> - </mrow> - <mi>seriesLimit</mi> - </munderover> - <mrow> - <msup> - <mrow> - <mo>(</mo> - <mi>-1</mi> - <mo>)</mo> - </mrow> - <mrow> - <mi>2</mi> - <mi>i</mi> - </mrow> - </msup> - <mfrac> - <msup> - <mi>x</mi> - <mrow> - <mi>2</mi> - <mo>i</mo> - <mo>+</mo> - <mi>1</mi> - </mrow> - </msup> - <mrow> - <mrow> - <mo>(</mo> - <mi>2</mi> - <mi>i</mi> - <mo>+</mo> - <mi>1</mi> - <mo>)</mo> - </mrow> - <mo>!</mo> - </mrow> - </mfrac> - </mrow> - </mrow> - </mrow> - </mtd> - </mtr> - </mtable> -</math>} - * - * @param x The sine's argument as in {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> -</math>} - * - * @return The value {@html.extend -<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow> - <mi>sin</mi> - <mo></mo> - <mrow> - <mo>(</mo> - <mi>x</mi> - <mo>)</mo> - </mrow> - </mrow> -</math>} itself. -*/ - public static double sin(double x) { - // Step 1: Normalize x to [-PI, +PI[ - final long countTimes2PI = (long) java.lang.Math.rint(x / 2 / PI); - if (countTimes2PI != 0) { - x -= 2 * PI * countTimes2PI; - } - - // Step 2: Normalize x to [-PI/2, +PI/2] - // Since sin(x) = sin (PI - x) we continue to normalize - // having x in [-PI/2, +PI/2] - if (PI/2 < x) { - x = PI - x; - } else if (x < -PI/2) { - x = -x - PI; - } - - // Step 3: Continue with business as usual - - double currentTerm = x, // the first (i == 0) term x^1/1! - sum = currentTerm; // initialize to the power series' first term - - // Slightly incorrect if seriesLimit is even - for (int i = 1; i <= seriesLimit; i += 2) { // Caution: Steps of two!! - final double previousTerm = // save the current term - currentTerm *= x * x / (2 * i) / (2 * i + 1) ; - currentTerm *= x * x / (2 * i + 2) / (2 * i + 3); - sum += currentTerm - previousTerm; //Summing up reordered - } - return sum; - }} diff --git a/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java b/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java similarity index 95% rename from P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java rename to P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java index 1ee20564d..e478f7101 100644 --- a/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/de/sd1/math/Driver.java +++ b/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Driver.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; /** * Testing {@link Math#sin(double)}in diff --git a/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Math.java b/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Math.java new file mode 100644 index 000000000..212c9f2a3 --- /dev/null +++ b/P/Sd1/math/V4/src/main/java/de/hdm_stuttgart/sd1/math/Math.java @@ -0,0 +1,95 @@ +package de.hdm_stuttgart.sd1.math; + +/** + * <p>This class implements a subset of functions from class + * {@link java.lang.Math} using power series expansions.</p> + * + */ +public class Math { + + private static final double PI = java.lang.Math.PI; + + static int seriesLimit = 5; + + /** + * + * @param seriesLimit The number of terms of a power series to be included. + * + */ + public static void setSeriesLimit(int seriesLimit) { + Math.seriesLimit = seriesLimit; + } + + /** + * <p>Approximating the natural exponential function by a finite + * number of terms from the corresponding power series expansion.</p> + * + * \[ \begin{aligned} + * e^x ={} & 1 + {x\over 1!} + {x^2\over 2!} + {x^3\over 3!} + \dots \\ + * ={} & \sum_{i = 0}^\infty {x^i\over i!} + * \end{aligned} \] + * + * A power series implementation has to be finite since an + * infinite number of terms requires infinite execution time. + * + * The number of terms to be considered can be set by {@link #setSeriesLimit(int)}} + * + * @param x The exponential's argument as in \( e^x \) + + * @return The value \( e^x \) itself. + */ + public static double exp(double x) { + double currentTerm = 1., // the first (i == 0) term x^0/0! + sum = currentTerm; // initialize to the power series' first term + + for (int i = 1; i <= seriesLimit; i++) { // i = 0 has already been completed. + currentTerm *= x / i; + sum += currentTerm; + } + return sum; + } + + /** + * <p>Calculating the sine by means of the corresponding power series.</p> + * + \[ + \begin{aligned} + \text{sin}(x) ={} & x - {x^3\over 3!} + {x^5\over 5!} - {x^7\over 7!} + \dots \\ + ={} & \sum_{i = 0}^\infty {(-1)^i {x^{2i+1}\over (2i+1)!}} + \end{aligned} + \] + * + * @param x The sine's argument as in \( \text{sin}(x) \). + * + * @return The value \( \text{sin}(x) \) itself. + */ + public static double sin(double x) { + // Step 1: Normalize x to [-PI, +PI[ + final long countTimes2PI = (long) java.lang.Math.rint(x / 2 / PI); + if (countTimes2PI != 0) { + x -= 2 * PI * countTimes2PI; + } + + // Step 2: Normalize x to [-PI/2, +PI/2] + // Since sin(x) = sin (PI - x) we continue to normalize + // having x in [-PI/2, +PI/2] + if (PI/2 < x) { + x = PI - x; + } else if (x < -PI/2) { + x = -x - PI; + } + + // Step 3: Continue with business as usual + + double currentTerm = x, // the first (i == 0) term x^1/1! + sum = currentTerm; // initialize to the power series' first term + + // Slightly incorrect if seriesLimit is even + for (int i = 1; i <= seriesLimit; i += 2) { // Caution: Steps of two!! + final double previousTerm = // save the current term + currentTerm *= x * x / (2 * i) / (2 * i + 1) ; + currentTerm *= x * x / (2 * i + 2) / (2 * i + 3); + sum += currentTerm - previousTerm; //Summing up reordered + } + return sum; + }} diff --git a/P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java b/P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java similarity index 89% rename from P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java rename to P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java index f438c5f2c..c5d84dd04 100644 --- a/P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/de/sd1/math/ExpTest.java +++ b/P/Sd1/math/V4/src/test/java/de/hdm_stuttgart/sd1/math/ExpTest.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.de.sd1.math; +package de.hdm_stuttgart.sd1.math; import static org.junit.Assert.*; diff --git a/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml b/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml index cb2496e12..0e8eebc59 100644 --- a/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml +++ b/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml @@ -4,7 +4,7 @@ <groupId>de.hdm_stuttgart.sda1.insert</groupId> <artifactId>insert_user</artifactId> - <version>0.1</version> + <version>0.2</version> <packaging>jar</packaging> <description>Providing unit test.</description> diff --git a/P/Sda1/Lectures/Surrogate/.idea/inspectionProfiles/Project_Default.xml b/P/Sda1/Lectures/Surrogate/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 5692e01b5..000000000 --- a/P/Sda1/Lectures/Surrogate/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,17 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <profile version="1.0"> - <option name="myName" value="Project Default" /> - <inspection_tool class="HardCodedStringLiteral" enabled="true" level="INFORMATION" enabled_by_default="true"> - <option name="ignoreForAssertStatements" value="true" /> - <option name="ignoreForExceptionConstructors" value="true" /> - <option name="ignoreForSpecifiedExceptionConstructors" value="" /> - <option name="ignoreForJUnitAsserts" value="true" /> - <option name="ignoreForClassReferences" value="true" /> - <option name="ignoreForPropertyKeyReferences" value="true" /> - <option name="ignoreForNonAlpha" value="true" /> - <option name="ignoreAssignedToConstants" value="false" /> - <option name="ignoreToString" value="false" /> - <option name="nonNlsCommentPattern" value="NON-NLS" /> - </inspection_tool> - </profile> -</component> \ No newline at end of file diff --git a/P/Sda2/Jpa/Inherit/Tpch/pom.xml b/P/Sda2/Jpa/Inherit/Tpch/pom.xml index 8401e98a9..d2b6edf7b 100644 --- a/P/Sda2/Jpa/Inherit/Tpch/pom.xml +++ b/P/Sda2/Jpa/Inherit/Tpch/pom.xml @@ -30,6 +30,12 @@ <version>2.5.0</version> </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.3.0</version> + </dependency> + </dependencies> <build> diff --git a/P/pom.xml b/P/pom.xml index d99f137b9..611406c7a 100644 --- a/P/pom.xml +++ b/P/pom.xml @@ -19,9 +19,6 @@ <name>Martin Goik lecture note examples</name> <modules> - <!-- Mathml related extension --> - - <module>Deps/HtmlExtensionTaglet</module> <!-- Software development 1 standalone pom.xml files --> @@ -67,9 +64,6 @@ <module>Sd1/Figure/ToString</module> <module>Sd1/Figure/Scale</module> <module>Sd1/Figure/BaseClass</module> - <module>Sd1/CarJump/V5</module> - <module>Sd1/CarJump/V1</module> - <module>Sd1/CarJump/V2</module> <module>Sd1/math/V0_7</module> <module>Sd1/math/V1</module> <module>Sd1/math/V3</module> diff --git a/pom.xml b/pom.xml index 4fc21d121..1e6ee3f51 100644 --- a/pom.xml +++ b/pom.xml @@ -45,20 +45,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> + <version>3.0.1</version> <configuration> <linksource>true</linksource> - <additionalparam>--allow-script-in-comments -header <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalparam> - <taglets> - <taglet> - <tagletClass>de.hdm_stuttgart.sd1.taglet.HtmlExtensionTaglet</tagletClass> - <tagletArtifact> - <groupId>de.hdm-stuttgart.sd1</groupId> - <artifactId>taglet</artifactId> - <version>1.2</version> - </tagletArtifact> - </taglet> - </taglets> + <additionalOptions> + <additionalOption>--allow-script-in-comments</additionalOption> + <additionalOption>-html5 --allow-script-in-comments -header + <![CDATA['<script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>']]></additionalOption> + </additionalOptions> </configuration> </plugin> -- GitLab