Selecting parts of algebraic expressions?
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
Is there a command to select factor polynomial
(a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
and exponent of E
(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
from the top expression?
algebraic-manipulation
add a comment |Â
up vote
5
down vote
favorite
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
Is there a command to select factor polynomial
(a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
and exponent of E
(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
from the top expression?
algebraic-manipulation
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
Is there a command to select factor polynomial
(a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
and exponent of E
(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
from the top expression?
algebraic-manipulation
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
Is there a command to select factor polynomial
(a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
and exponent of E
(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)
from the top expression?
algebraic-manipulation
algebraic-manipulation
edited Oct 1 at 6:51
kglr
164k8188388
164k8188388
asked Oct 1 at 6:00
Chandan Sharma
795
795
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
6
down vote
myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
myEq /. a_ E^b_ -> a
and
myEq /. a_ E^b_ -> b
add a comment |Â
up vote
5
down vote
You can use Exponent
and Coefficient
as follows:
exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
Exponent[exp, E]
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
Coefficient[exp, E, Exponent[exp, E]]
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
add a comment |Â
up vote
1
down vote
Another way. It works because both of the sub-expressions to be extracted have head Plus
and are the only ones to do so.
expr =
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];
factr
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
expon
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
myEq /. a_ E^b_ -> a
and
myEq /. a_ E^b_ -> b
add a comment |Â
up vote
6
down vote
myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
myEq /. a_ E^b_ -> a
and
myEq /. a_ E^b_ -> b
add a comment |Â
up vote
6
down vote
up vote
6
down vote
myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
myEq /. a_ E^b_ -> a
and
myEq /. a_ E^b_ -> b
myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
myEq /. a_ E^b_ -> a
and
myEq /. a_ E^b_ -> b
answered Oct 1 at 6:24
David G. Stork
21.7k11747
21.7k11747
add a comment |Â
add a comment |Â
up vote
5
down vote
You can use Exponent
and Coefficient
as follows:
exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
Exponent[exp, E]
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
Coefficient[exp, E, Exponent[exp, E]]
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
add a comment |Â
up vote
5
down vote
You can use Exponent
and Coefficient
as follows:
exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
Exponent[exp, E]
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
Coefficient[exp, E, Exponent[exp, E]]
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
add a comment |Â
up vote
5
down vote
up vote
5
down vote
You can use Exponent
and Coefficient
as follows:
exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
Exponent[exp, E]
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
Coefficient[exp, E, Exponent[exp, E]]
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
You can use Exponent
and Coefficient
as follows:
exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
Exponent[exp, E]
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
Coefficient[exp, E, Exponent[exp, E]]
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
answered Oct 1 at 6:48
kglr
164k8188388
164k8188388
add a comment |Â
add a comment |Â
up vote
1
down vote
Another way. It works because both of the sub-expressions to be extracted have head Plus
and are the only ones to do so.
expr =
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];
factr
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
expon
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
add a comment |Â
up vote
1
down vote
Another way. It works because both of the sub-expressions to be extracted have head Plus
and are the only ones to do so.
expr =
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];
factr
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
expon
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Another way. It works because both of the sub-expressions to be extracted have head Plus
and are the only ones to do so.
expr =
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];
factr
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
expon
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
Another way. It works because both of the sub-expressions to be extracted have head Plus
and are the only ones to do so.
expr =
(a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];
factr
e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2
expon
e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2
edited Oct 1 at 15:09
answered Oct 1 at 7:15
m_goldberg
82.5k869190
82.5k869190
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182915%2fselecting-parts-of-algebraic-expressions%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password