Message Boards Message Boards

0
|
1146 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to pick/select the coefficients of the same constant from the output of 3 equations

Posted 7 months ago

I have 3 equations Xi[1][x,t], Xi[2][t] , Phi[x, t], whose outputs are expressed in terms of variables {t, x, u}.
I want to generate X1 (an equation expressed in terms of variables {t,x,u} and constants C1, C2, ... , C6), similarly X2, X3, ... , X6. Please see an attachment on the attempts.

My goal is to write a syntax to select / pick the coefficient of the same constant from the 3 equations as shown below:

X1 = {{1/2 E^(-t \[Beta]) (1 + E^(2 t \[Beta])), 0,  u (-((E^(-t \[Beta]) (-1 + E^(
t \[Beta])) (4 E^(t \[Beta]) \[Alpha] \[Beta] - \[Sigma]^2 -  E^(t \[Beta]) \[Sigma]^2))/(2 \[Beta] \[Sigma]^2)) +  1/\[Sigma]^2 (2 x \[Beta] (1/  2 E^(-t \[Beta]) (1 + E^(2 t \[Beta]))) + 
2 x (E^(t \[Beta]) \[Beta] - 1/2 E^(-t \[Beta]) (1 + E^(2 t \[Beta])) \[Beta]  )))}, 

 X2 = {(E^(-t \[Beta]) (-1 + E^(2 t \[Beta])))/(2 \[Beta]), 0, 
u (-((E^(-t \[Beta]) (-1 + E^(
t \[Beta])) (4 E^(
t \[Beta]) \[Alpha] \[Beta] + \[Sigma]^2 - 
E^(t \[Beta]) \[Sigma]^2))/(2 \[Beta]^2 \[Sigma]^2)) + 
1/\[Sigma]^2 (2 x \[Beta] ((
E^(-t \[Beta]) (-1 + E^(2 t \[Beta])))/(2 \[Beta])) + 
2 x (E^(t \[Beta]) - 
1/2 E^(-t \[Beta]) (-1 + E^(2 t \[Beta])) )))}, 

X3 = {0, 0, u}, 

X4 = {0, 1, 0}
POSTED BY: Nomsa Ledwaba
2 Replies
Posted 7 months ago

Something like this?

eq1 = Xi[1][x, t] -> 
  1/2 D[(*Xi[2][t]*)
     C[4] + (E^(-2 t β) (-1 + E^(4 t β)) C[5])/(
      4 β) + (E^(-2 t β) (-1 + E^(2 t β))^2 C[6])/(
      8 β^2), t] x +(*h[t]*)
   1/2 E^(-t β) (1 + E^(2 t β)) C[1] + (
   E^(-t β) (-1 + E^(2 t β)) C[2])/(2 β) - (
   E^(-2 t β) (-1 + E^(t β))^2 (1 + E^(t β) + E^(
      2 t β)) (2 α β - σ^2) C[5])/(
   8 β^2) - (
   E^(-2 t β) (-1 + E^(t β))^3 (1 + E^(
      t β)) (2 α β - σ^2) C[6])/(
   16 β^3)

constants = Array[C, 6]

eq1Coefficients = AssociationMap[Coefficient[Last@eq1, #] &, constants]

Dataset@eq1Coefficients

enter image description here

Similarly for the other equations

POSTED BY: Rohit Namjoshi
Posted 7 months ago

Yes indeed in terms of picking / selecting the coefficients from the 3 equations. Absolutely correct for 1 of 3 equations.

POSTED BY: Nomsa Ledwaba
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract