diff --git a/Makefile b/Makefile index d46308d4432f372a52d075aa7371905077fd1832..c1167bbd84dc840b34c7477bb0f93e6961998ac6 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 4e247eee2103b4d4a35eba38166587fee1391f0e..0000000000000000000000000000000000000000 --- 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 5077d953d9cd92451b3a7d5c1d6ee9c136b386b8..0000000000000000000000000000000000000000 --- 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 30e53d8998593eab12b9d26e5ade8782ef261abb..0000000000000000000000000000000000000000 --- 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 6ca7e5d79c543b7e3c0885480c2b75bbe3df7f4a..0000000000000000000000000000000000000000 --- 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 a756ce90575c25a1a06265fdbb4dda9673b29513..0000000000000000000000000000000000000000 --- 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 d261b78a53a36082e263552774c606a9b22d462f..2a5719865ac69c7725c1a8a75e944deddad70886 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 c02e6b4864baf0e65a95af4e197ef8c7d1e74e3a..ef2d7b05f688ad381733624437d716932a699ace 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 4075e93120b58aab2cad33bdc162b4c00f2b5a91..a51b4515cc2b6dd60aa39e773a7ad000f03adfde 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 226a1d6b5065b619b4e58ea3933ad4224c9caa79..165aba49589487c30cd505d6b6ded39c03add6e6 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 c31228a1bf1d538319a831ab7d90d2e678907e8d..3899cde59301a2adcd4c6d120f0e447c3770c1be 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 4f49d34e1ba7e42cea8861a39c291da0d0ae4f74..49c1c34bc8eee39e60af10fc6b6cd69682a4720b 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 81452cb0102203824cd18cf7b6216a2ac27843b5..90156400453abfe66f422cf1497e2ac38676dec4 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 8385961236d67231576c8895b711ac58a84f327e..a4f9c95bec997f9fd32417749b89fd5873a8425f 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 9e322d1b5ac535f7ec662e4396a7efd73a4095aa..945a09b59c298da218e57f79b67ce56612d84953 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 abddf847af0dc4dce4f196b771d9b034ec51a68a..836ebed10f19ce54b3ec532e491ab1bd06d4ecf8 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 6116f9926c1253b3719d53f62b550f8405a54b8b..1af37f36652a4ab0213d998e5959a23a7da50376 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 0c829cd23b38dfc6c996c02c429f8247428f06a9..0000000000000000000000000000000000000000 --- 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 f6be81c32a3cee372e4a6c61fe8b9b02210e1a43..b60412e6af30144d3c45f02bf6914896a6c2eae8 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 0000000000000000000000000000000000000000..3847a368e36ac8a1c50025d867565e0eadea0319 --- /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 6a2572c7f50b2ce44b35b7da5adf3d47a14d5c75..438949f1eabf660130cf1250ba465b12ec6afd30 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 ae4b4ad83f0dd0a867e80cc8c75992ab17e476ca..1aae1daedb1ee39cf4a5ca965e66a2c50e8842f5 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 cc3de52fa9c96dd18086c21b932e4e897f58d199..0000000000000000000000000000000000000000 --- 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 856beb072632279ba49c95fc60e69647aba07da3..a0600de65ab7c3d1a3968818500e85ee51d7ff3e 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 0000000000000000000000000000000000000000..d461cb9632137296f5b67bcfdb84f9303cf18dfb --- /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 bac0201f932e734b1c870202e2df0ae2474bef7f..57f38bca78790a672a325f868c04fc0036e9ac52 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 258a877c5f04398af776cdb03953f06cfd990520..2765e5be9f12eda3ef7c46527835017ae9d47e11 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 fc7419c2d12ca4fe5892d8940c6bc5bcb897c267..0000000000000000000000000000000000000000 --- 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 1c11b947fde71af980d5e0d12e9adda5c3f3163b..9f06ebbd4337f117d6d42feb733198cf5df339c1 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 ed2b420c5c465e2245cbdfae4d880d1d17a116a7..6c403fda1adc2e82e6aea2399c304a0d477b798f 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 0000000000000000000000000000000000000000..78cbb014cb3eb9a30873e9a6a583a8344bd30226 --- /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 baf3977a54f083ba89be86a691a77b386ce52296..ca27825b66454cf3ff6d468cc6c99e51ce72592f 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 9715441df5fdc94363afca761c1872dd0d9fa989..52c32c4d61d9b523cbed7a4dad36af61bb8092b4 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 f38cafe35bd3bcc89efee8026d58476b1a11b112..0000000000000000000000000000000000000000 --- 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 1ee20564de604df183024bc7cd2b49fb63e7613d..e478f71019e7f5ad33d60fab7e236787f1af4e90 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 0000000000000000000000000000000000000000..212c9f2a3036cc5e8be12456d7e4b9715ae8aaf4 --- /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 f438c5f2c37abeb82f46ae826225e1ac08294b34..c5d84dd04293398178094758d16dc6f29a68b1df 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 cb2496e12d124f80694ed7a6d7e0626e7d75e831..0e8eebc5972f9953ebb654ec27be3ea9ed34e879 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 5692e01b53bec1214c4a87f69eca44621e1531cf..0000000000000000000000000000000000000000 --- 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 8401e98a9a286e6d92a296d724c92da4542e3bf1..d2b6edf7b94b21ba1402fcab9bd037c628c68931 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 d99f137b97a717f8941fa3c4ab856b1d83e36b65..611406c7a2e965cbef1435e72023d043af642539 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 4fc21d121a819c1c2c72f69fa34713223e6f7b7d..1e6ee3f510a6428b6f696c1edddefde979006d60 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>