Skip to content

Commit

Permalink
partial fix for issue #14 - problems with ilt()
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarmein-ts committed Mar 30, 2024
1 parent 0a771bb commit 5839284
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Extra.js
Expand Up @@ -27,6 +27,7 @@ if((typeof module) !== 'undefined') {
S = core.groups.S,
EX = core.groups.EX,
CP = core.groups.CP,
PL = core.groups.PL,
CB = core.groups.CB,
FN = core.groups.FN;
core.Settings.Laplace_integration_depth = 40;
Expand Down Expand Up @@ -170,7 +171,7 @@ if((typeof module) !== 'undefined') {
//num = core.Algebra.Factor.factor(symbol.getNum());
//den = core.Algebra.Factor.factor(symbol.getDenom().invert(null, true));

if(den.group === CP) {
if(den.group === CP || den.group === PL) {
den_p = den.power.clone();
den.toLinear();
}
Expand Down Expand Up @@ -357,6 +358,8 @@ if((typeof module) !== 'undefined') {
else {
retval = new Symbol(0);

symbol = core.Algebra.PartFrac.partfrac(_.expand(symbol), s_);

symbol.each(function (x) {
retval = _.add(retval, __.LaPlace.inverse(x, s_, t));
}, true);
Expand Down
2 changes: 1 addition & 1 deletion all.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions spec/extra.spec.js
Expand Up @@ -39,6 +39,7 @@ describe('Extra Calculus', function () {
expect(nerdamer('ilt(((s+1)*(s+2)*(s+3))^(-1), s, t)').toString()).toEqual('(1/2)*e^(-3*t)+(1/2)*e^(-t)-e^(-2*t)');
expect(nerdamer('ilt(1/(s^2+s+1),s,t)').toString()).toEqual('2*e^((-1/2)*t)*sin((1/2)*sqrt(3)*t)*sqrt(3)^(-1)');
expect(nerdamer('ilt(1/(s^2+2s+1),s,t)').toString()).toEqual('e^(-t)*t');
// expect(nerdamer('ilt(1/((s)(s^2+4s+1)),s,t)').toString()).toEqual('1+e^(-2*t)*i^(-1)*sin(i*sqrt(3)*t)*sqrt(3)^(-1)');
});

it('should calculate mode correctly', function () {
Expand Down
4 changes: 3 additions & 1 deletion spec/test.js
Expand Up @@ -6,6 +6,7 @@ var nerdamer = require('../nerdamer.core.js');
require('../Algebra.js');
require('../Calculus.js');
require('../Solve.js');
require('../Extra.js');
console.global = {tsDebugChannels: {notimeout: true}};


Expand Down Expand Up @@ -37,7 +38,8 @@ console.global = {tsDebugChannels: {notimeout: true}};
let x;

try {
x=nerdamer('log10(x)').simplify().text();
x=nerdamer('ilt(1/(s^3+4s^2+s),s,t)').text();
// x=nerdamer('ilt(1/(s^2+2s+1),s,t)').toString()
} catch (error) {
console.log("error "+error)
}
Expand Down

0 comments on commit 5839284

Please sign in to comment.