1
$\begingroup$

I need to solve 6*6 equations over and over and put the coefficient into the equations again. But I don not know how? Can anyone help me?

u[x_, y_] := a1 + a2*x + a3*y + a4*x^2 + a5*x*y + a6*y^2

Solve[{u1 == u[0, 0], u2 == u[20, 0], u3 == u[10, 5], 
  u4 == u[10, 0], u5 == u[15, 2.5], u6 == u[5, 2.5]},
  {a1, a2, a3, a4, a5, a6}]

I need to backsubstitue a1,a2,... into the original equation and rewrite it for further use.

$\endgroup$
3
$\begingroup$
u[x_, y_] := a1 + a2*x + a3*y + a4*x^2 + a5*x*y + a6*y^2

solution = 
 Solve[{u1 == u[0, 0], u2 == u[20, 0], u3 == u[10, 5], u4 == u[10, 0],
     u5 == u[15, 2.5], u6 == u[5, 2.5]}, {a1, a2, a3, a4, a5, a6}] // Last;

uNew[x_,y_] := u[x, y] /. solution

uNew[x,y]//Rationalize
u1 + 1/20 (-3 u1 - u2 + 4 u4) x + 1/200 (u1 + u2 - 2 u4) x^2 + 
 1/10 (-3 u1 + u2 - 2 u3 - 4 u4 + 8 u6) y + 
 1/50 (u1 - u2 + 2 u5 - 2 u6) x y + 
 1/50 (u1 + u2 + 4 u3 + 2 u4 - 4 u5 - 4 u6) y^2
$\endgroup$
2
$\begingroup$

A very slight variation on @Ivan solution using rationals

u[x_, y_] = a1 + a2*x + a3*y + a4*x^2 + a5*x*y + a6*y^2;

soln1 = Solve[{u1 == u[0, 0], u2 == u[20, 0], u3 == u[10, 5], u4 == u[10, 0], 
       u5 == u[15, 2.5], u6 == u[5, 2.5]}, {a1, a2, a3, a4, a5, a6}][[1]] // 
    Rationalize[#, 10^-9] & // Simplify;

u[x_, y_] = u[x, y] /. soln1 // Simplify

(1/200)*(200*u1 - 10*(3*u1 + u2 - 4*u4)*x + (u1 + u2 - 2*u4)x^2 + 20(-3*u1 + u2 - 2*u3 - 4*u4 + 8*u6)y + 4(u1 - u2 + 2*u5 - 2*u6)xy + 4*(u1 + u2 + 4*u3 + 2*u4 - 4*u5 - 4*u6)*y^2)

{u1 == u[0, 0], u2 == u[20, 0], u3 == u[10, 5], u4 == u[10, 0], 
  u5 == u[15, 5/2], u6 == u[5, 5/2]} // Simplify

{True, True, True, True, True, True}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.