Skip to content

Commit c668c19

Browse files
committed
Add elimination rule for logarithmic expressions in EliminateRules
- `Solve(a*x^n+b*Log(c*x)+d==0, x)`
1 parent aa22b48 commit c668c19

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/reflection/system/rulesets/EliminateRules.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public static Matcher init2() {
3333
// elimzeroplus(c_.+Log(b_.*x_)*x_^a_.,x_):=((-a*c)/ProductLog((-a*c)/((1/b))^a))^(1/a)/;FreeQ({a,b,c},x)
3434
matcher.caseOf($(elimzeroplus,Plus(c_DEFAULT,Times(Log(Times(b_DEFAULT,x_)),Power(x_,a_DEFAULT))),x_),
3535
Condition(Power(Times(CN1,a,c,Power(ProductLog(Times(CN1,a,Power(Power(Power(b,CN1),a),CN1),c)),CN1)),Power(a,CN1)),FreeQ(list(a,b,c),x)));
36+
// elimzeroplus(Log(c_.*x_)*b_.+d_.+a_.*x_^n_.,x_):=((b*ProductLog((a*((1/(E^(d/b)*c)))^n*n)/b))/(a*n))^(1/n)/;FreeQ({a,b,c,d,n},x)
37+
matcher.caseOf($(elimzeroplus,Plus(Times(Log(Times(c_DEFAULT,x_)),b_DEFAULT),d_DEFAULT,Times(a_DEFAULT,Power(x_,n_DEFAULT))),x_),
38+
Condition(Power(Times(b,Power(Times(a,n),CN1),ProductLog(Times(a,Power(b,CN1),Power(Power(Times(Exp(Times(Power(b,CN1),d)),c),CN1),n),n))),Power(n,CN1)),FreeQ(List(a,b,c,d,n),x)));
3639
// elimzeroplus(w_.*Sqrt(a_.+b_.*x_)+x_*y_.+z_.,x_):={(b*w^2-2*y*z-w*Sqrt(b^2*w^2+4*a*y^2-4*b*y*z))/(2*y^2),(b*w^2-2*y*z+w*Sqrt(b^2*w^2+4*a*y^2-4*b*y*z))/(2*y^2)}/;FreeQ({a,b,w,y,z},x)&&!PossibleZeroQ(y)
3740
matcher.caseOf($(elimzeroplus,Plus(Times(w_DEFAULT,Sqrt(Plus(a_DEFAULT,Times(b_DEFAULT,x_)))),Times(x_,y_DEFAULT),z_DEFAULT),x_),
3841
Condition(list(Times(Power(Times(C2,Sqr(y)),CN1),Plus(Times(b,Sqr(w)),Times(CN2,y,z),Times(CN1,w,Sqrt(Plus(Times(Sqr(b),Sqr(w)),Times(C4,a,Sqr(y)),Times(CN4,b,y,z)))))),Times(Power(Times(C2,Sqr(y)),CN1),Plus(Times(b,Sqr(w)),Times(CN2,y,z),Times(w,Sqrt(Plus(Times(Sqr(b),Sqr(w)),Times(C4,a,Sqr(y)),Times(CN4,b,y,z))))))),And(FreeQ(List(a,b,w,y,z),x),Not(PossibleZeroQ(y)))));

symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/SolveTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,8 @@ public void testSolveExp() {
22542254

22552255
@Test
22562256
public void testSolveLog() {
2257+
check("Solve(a*x^n+b*Log(c*x)+d==0, x)", //
2258+
"{{x->((b*ProductLog((a*(1/(c*E^(d/b)))^n*n)/b))/(a*n))^(1/n)}}");
22572259
check("Solve(x^a*Log(b*x)+c==0, x)", //
22582260
"{{x->((-a*c)/ProductLog((-a*c)/((1/b))^a))^(1/a)}}");
22592261
check("Solve(x^c*Log(x)==0, x)", //

symja_android_library/rule_sets/EliminateRules.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
elimzeroplus(x_^a_.*Log(b_.*x_)+c_., x_) := (-((a*c)/ProductLog(((-a)*c)/(1/b)^a)))^(1/a)
2323
/; FreeQ({a,b,c},x),
2424

25+
elimzeroplus(a_.*x_^n_.+b_.*Log(c_.*x_)+d_., x_) := ((b*ProductLog((a*((1/(E^(d/b)*c)))^n*n)/b))/(a*n))^(1/n)
26+
/; FreeQ({a,b,c,d,n},x),
27+
2528
elimzeroplus(y_.*x_+w_.*Sqrt(a_.+b_.*x_)+z_., x_) := {(b*w^2-2*y*z-w*Sqrt(b^2*w^2+4*a*y^2-4*b*y*z))/(2*y^2),
2629
(b*w^2-2*y*z+w*Sqrt(b^2*w^2+4*a*y^2-4*b*y*z))/(2*y^2)}
2730
/; FreeQ({a,b,w,y,z},x)&&!PossibleZeroQ(y),

0 commit comments

Comments
 (0)