Kitonum

21830 Reputation

26 Badges

17 years, 220 days

MaplePrimes Activity


These are answers submitted by Kitonum

Here is step by step solution. I used my procedure  JordanGausse . This procedure step by step solves any system of linear equations by Gauss - Jordan elimination. In the procedure, the Russian text is used. After I prepare the English version, I will submit  code of the procedure to the mapleprimes forum.

Unfortunately, when loading the Russian text was distorted. Here is a translation into English:

Step 1: write the system in matrix form

Step 2: divide row 1 by 4

Step 3: row 1, multiplied by -2, add to row 2

Step 4: row 1, multiplied by -4, add to row 3

Step 5: swap the positions of columns 2 and 3

Step 6: divide row 2 by 3/2

and so on ...

 

Sys:=
     4*x1 + 2*x2 - 7*x3 - 11*x4 = 5,
         
     2*x1 + 1*x2 - 2*x3 - 4*x4 = 2,
         
     4*x1 + 2*x2 - 10*x3 - 14*x4 = 6:

X:= [x||(1..4)]:
A, V:= LinearAlgebra:-GenerateMatrix([Sys], X);

A, V := Matrix(3, 4, {(1, 1) = 4, (1, 2) = 2, (1, 3) = -7, (1, 4) = -11, (2, 1) = 2, (2, 2) = 1, (2, 3) = -2, (2, 4) = -4, (3, 1) = 4, (3, 2) = 2, (3, 3) = -10, (3, 4) = -14}), Vector(3, {(1) = 5, (2) = 2, (3) = 6})

(1)

JordanGausse(A, V);

`Çàäàííàÿ ñèñòåìà`

``

4*x[1]+2*x[2]-7*x[3]-11*x[4] = 5

2*x[1]+x[2]-2*x[3]-4*x[4] = 2

4*x[1]+2*x[2]-10*x[3]-14*x[4] = 6

``

``

`Øàã  ¹ 1:  çàïèøåì ñèñòåìó â ìàòðè÷íîé ôîðìå.`

`Ïîëó÷èì:`

``

"[[[x[1],x[2],x[3],x[4],,],[,,,,,],[4,2,-7,-11,,5],[2,1,-2,-4,,2],[4,2,-10,-14,,6]]]"

``

``

``

`Øàã  ¹ 2 : ïîäåëèì âñå ýëåìåíòû ñòðîêè  ¹  1  íà  4`

`Ïîëó÷èì:`

``

"[[[x[1],x[2],x[3],x[4],,],[,,,,,],[1,1/2,-7/4,-11/4,,5/4],[2,1,-2,-4,,2],[4,2,-10,-14,,6]]]"

``

``

``

`Øàã  ¹ 3:  ê ñòðîêå  ¹ 2  ïðèáàâèì ñòðîêó  ¹ 1  , óìíîæåííóþ íà      -2.`

`Ïîëó÷èì:`

``

"[[[x[1],x[2],x[3],x[4],,],[,,,,,],[1,1/2,-7/4,-11/4,,5/4],[0,0,3/2,3/2,,-1/2],[4,2,-10,-14,,6]]]"

``

``

``

`Øàã  ¹ 4:  ê ñòðîêå  ¹ 3  ïðèáàâèì ñòðîêó  ¹ 1  , óìíîæåííóþ íà      -4.`

`Ïîëó÷èì:`

``

"[[[x[1],x[2],x[3],x[4],,],[,,,,,],[1,1/2,-7/4,-11/4,,5/4],[0,0,3/2,3/2,,-1/2],[0,0,-3,-3,,1]]]"

``

``

``

`Øàã  ¹ 5:  ïîìåíÿåì ìåñòàìè ñòîëáåö  ¹ 2  è                ñòîëáåö  ¹ 3.`

`Ïîëó÷èì:`

``

"[[[x[1],x[3],x[2],x[4],,],[,,,,,],[1,-7/4,1/2,-11/4,,5/4],[0,3/2,0,3/2,,-1/2],[0,-3,0,-3,,1]]]"

``

``

``

`Øàã  ¹ 6 : ïîäåëèì âñå ýëåìåíòû ñòðîêè  ¹  2  íà  3/2`

`Ïîëó÷èì:`

``

"[[[x[1],x[3],x[2],x[4],,],[,,,,,],[1,-7/4,1/2,-11/4,,5/4],[0,1,0,1,,-1/3],[0,-3,0,-3,,1]]]"

``

``

``

`Øàã  ¹ 7:  ê ñòðîêå  ¹ 3  ïðèáàâèì ñòðîêó  ¹ 2  , óìíîæåííóþ íà      3.`

`Ïîëó÷èì:`

``

"[[[x[1],x[3],x[2],x[4],,],[,,,,,],[1,-7/4,1/2,-11/4,,5/4],[0,1,0,1,,-1/3],[0,0,0,0,,0]]]"

``

``

``

`Øàã  ¹ 8:  âû÷åðêíåì ñòðîêó  ¹ 3  ò.ê. îíà   ñîñòîèò èç îäíèõ íóëåé`

`Ïîëó÷èì:`

``

"[[[x[1],x[3],x[2],x[4],,],[,,,,,],[1,-7/4,1/2,-11/4,,5/4],[0,1,0,1,,-1/3]]]"

``

``

``

`Øàã  ¹ 9:  âûáåðåì â êà÷åñòâå áàçèñíûõ íåèçâåñòíûå, ñîîòâåòñòâóþùèå ïåðâûì   2   ñòîëáöàì.
  Îñòàëüíûì íåèçâåñòíûì ïðèäà¸ì ïðîèçâîëüíûå çíà÷åíèÿ    ` || (x[2] = C[1]) || (x[4] = C[2]) || ` è ñîîòâåòñòâóþùèå ñëàãàåìûå  ïåðåíîñèì â ïðàâûå ÷àñòè óðàâíåíèé`

`Ïîëó÷èì:`

``

"[[[x[1],x[3],,],[,,,],[1,-7/4,,5/4-1/2 C[1]+11/4 C[2]],[0,1,,-1/3-C[2]]]]"

``

``

``

`Øàã  ¹ 10:  ê ñòðîêå  ¹    1  ïðèáàâèì ñòðîêó  ¹   2  ,  óìíîæåííóþ   íà      7/4.`

`Ïîëó÷èì:`

``

"[[[x[1],x[3],,],[,,,],[1,0,,2/3-1/2 C[1]+C[2]],[0,1,,-1/3-C[2]]]]"

``

``

``

`Îòâåò:`

``

Vector(4, {(1) = x[1] = 2/3-(1/2)*C[1]+C[2], (2) = x[2] = C[1], (3) = x[3] = -1/3-C[2], (4) = x[4] = C[2]})

``

``

``

(2)

 

 

Download Gauss-Jordan.mws

 

It is well known that a square system has a unique solution if and only if it's main determinant is not 0.

restart;

A:= < k+3, 2, k-4, 3;

      0,   2,  -9, 5;

      0,   0, k^2+k-2, k-1 >;

B:=A[..,1..3];

V:=A[..,4];

LinearAlgebra[Determinant](B);

Sol:=[solve(%)];

 

We have a unique solution for any number  k  not included in this list.

 

Next solve separately for each number from  list  Sol:

for i from 1 to 3 do

'k'=Sol[i],  LinearAlgebra[LinearSolve](op(eval([B,V],'k'=Sol[i])), free=C);

od;

 

Thus for  k=-3  and  k=1  we have infinitely many solutions, for  k=-2  no solutions

You made ​​a few syntax errors, which I corrected.
Your nonlinear system has 5 parameters. Maple can not solve it symbolically for all values ​​of the parameters, but Maple can  solve this system for the specified parameters.

restart;

f := proc (E2, T, DHT, Ca, Cshbg)

local KsT, KaT, KsE2, KaE2, KsDHT, KaDHT, eq1, eq2, eq3;

KsT := 0.10e11; KaT := 4.6*0.10e6; KsE2 := 3.14*0.10e10; KaE2 := 4.21*0.10e6; KsDHT := 3*0.10e6; KaDHT := 3.5*0.10e6;

eq1 := E2 = fE2*(1+(KaE2+Ca)/(1+KaE2*fE2+KaT*fT+KaDHT*fDHT)+KsE2*Cshbg/(1+KsE2*fE2+KsT*fT+KsDHT*fDHT));

eq2 := T = fT*(1+KaT*Ca/(1+KaE2*fE2+KaT*fT+KaDHT*fDHT)+KsT*Cshbg/(1+KsE2*fE2+KsT*fT+KsDHT*fDHT));

eq3 := DHT = fDHT*(1+KaDHT*Ca/(1+KaE2*fE2+KaT*fT+KaDHT*fDHT)+KsDHT*Cshbg/(1+KsE2*fE2+KsT*fT+KsDHT*fDHT));

solve({eq1, eq2, eq3})

end proc:

 

Example:

f(1, 2, 3, 4, 5);

 

 

We got 10 solutions.

 

 

Procedure  UniqueColumns  returns  the unique columns of a Matrix.

 

UniqueColumns:=proc(A::Matrix)

local L;

uses LinearAlgebra, ListTools;

L:=[Categorize((x,y)->Equal(x,y), [seq(A[..,i],i=1..ColumnDimension(A))])];

op(map(op,select(x->is(nops(x)=1), L)))

end;

 

Your example:

Q := Matrix([[1,1,1,0,0,0,-2,-1], [0,0,0,1,1,1,0,-3]]);

UniqueColumns(Q);

 

 

 

 

Write your function as a procedure:

f:=proc()

your expression

end;

 

Example:

f:=proc()

add(args[i]^2, i=1..nargs)

end;

 

f(1, 2, 3);

       14

I do not understand the meaning of the problem. If you want to write it in the same loop then 

for i in  [seq(i, i=0..100, 0.2), seq(i, i=100..0, -0.2)]  do ... od;

Multiplication signs, division sign and missing parenthesis

((5*x^2*y^2)-6*x^4)/((1-y^2)*(x^2+y^2)-(y^2*(1-x^2-y^2)));

 

The parenthesis can be put in another place.

 

This is arithmetical progression.

f:=unapply(rsolve({u(n+1)=u(n)+d, u(1)=a}, u(n))/b, n);

                              f := n -> (a+d*(n+1)-2*d)/b

 

Example:

eval(f(100000000000), {a=25, d=25, b=5});

                                         500000000000

Look at my posts   http://www.mapleprimes.com/users/Kitonum/posts 

You can find a number of interesting applications of them.

You can use geometric transformations from  plottools  package.

Examples:

with(plottools): with(plots):

F:=curve([[-4,0],[0,3],[1/2,0], [-4,0]], thickness=3):

F1:=reflect(F, [[-1,4],[1,4]]):

F2:=translate(F, -4, 2):

F3:=rotate(F, -Pi/2, [3,0]):

T:=textplot([[-1,1,"F"], [-1,7,"F1"], [-5,3,"F2"], [4,4,"F3"]], font=[TIMES,ROMAN,20], color=blue):

display(F, F1, F2, F3, T, scaling=constrained);

 

 

Code of procedure:

ExponentOfPower:=proc(monom, var)

`if`(not has(monom,var), 0,  `if`(nops(select(has,monom,var))>1, op(2,select(has,combine(monom),var)), 1));

end:

 

Examples:

term1:=3*x^k*y^(k+2): term2:=3*y^(k+2): term3:=3*x*y^(k+2): term4:=3*x^k*y^(k+2)*x^2:

op(map(ExponentOfPower, [term||(1..4)], x));

                                                                        k, 0, 1, k+2

 

Example with Carl's procedure:

power(x^x, x);

             x*ln(x)+x

f := t->piecewise(0 < t and t < 10, 1-t, 10 < t, t);

plot([f(t), [10, t, t = -9 .. 10]], t = 0 .. 15, thickness = [2, 1], color = [red, black], linestyle = [1, 2], discont, view = [-2.5 .. 14.5, -10 .. 14.5], scaling = constrained);

 

 

term:=3*x^k*y^(k+2):

op(2, select(has, term, x)),   op(2, select(has, term, y));

                                                  k, k+2

There is no triangle with sides 136, 170, 174, in which the coordinates of all vertices are integers or rational numbers. It is well known that the area of any such triangle is rational. But the area of your triangle is irrational:

a := 136: b := 170: c := 174:

p:=(a+b+c)/2:

sqrt(p*(p-a)*(p-b)*(p-c));

                                        240*2002^(1/2)

Tools -> Options -> Precision -> Round calculation ... -> Apply to Session or Apply Globally

First 238 239 240 241 242 243 244 Last Page 240 of 292