linear combination of two-component expressions
Asked by
Nico Schlömer
I would like to form the linear combination
\sum_i \alpha_i x_i
where the x_i are Expressions with two components.
I tried
Phi = Constant([0,0])
for alpha, x in (Alpha, X):
??? += alpha * x
??? += alpha * x
where X is a list of expressions. I'm not sure what to plug in for "???".
I tried Phi[0]/Phi[1], but got
TypeError: 'Constant' object does not support item assignment.
which makes sense, too.
Confusingly,
Phi0 = Constant(0)
Phi1 = Constant(0)
for alpha, x in (Alpha, X):
Phi0 += alpha * x
Phi1 += alpha * x
works, but I'd like Phi to be contained in one variable for the sake of consistency and plotting (see https:/
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Nico Schlömer
- Solved:
- Last query:
- Last reply:
To post a message you must log in.