Kitonum

20611 Reputation

26 Badges

16 years, 117 days

MaplePrimes Activity


These are answers submitted by Kitonum


 

restart;

v := 1: a := 0: b := 1: t := 0.1e-2: dt := 0.1e-3: N := 5: h := (b-a)/(N-1):

for i to N do x[i] := a+(i-1)*h end do:
p := x->product(x-x[k], k = 1 .. N);
f := expand(p(x));

proc (x) options operator, arrow; product(x-x[k], k = 1 .. N) end proc

 

x^5-(5/2)*x^4+(35/16)*x^3-(25/32)*x^2+(3/32)*x

(1)

PRime := diff(f, x);

5*x^4-10*x^3+(105/16)*x^2-(25/16)*x+3/32

(2)

for i to N do
for j to N do
 if i <> j then a[i, j] := (eval(PRime, x = x[i]))/((x[i]-x[j])*(eval(PRime, x  = x[j]))) else
 a[i, j] := -add(`if`(k<>i, a[i, k], undefined), k = 1 .. N) end if;  
 end do:
 end do:

seq(seq(a[i,j], i=1..N), j=1..N);

undefined, -1, 1/3, -1/3, 1, 16, undefined, -8/3, 2, -16/3, -12, 6, undefined, -6, 12, 16/3, -2, 8/3, undefined, -16, -1, 1/3, -1/3, 1, undefined

(3)

 


 

Download burgers_type_method_new.mw

A circle does not necessarily pass through 4 points, even if the points lie in the same plane. Therefore, we first find the center of the circle passing through points C, D, H, and then check that point K also lies on the same circle:


 

restart;
_local(D, O);
with(Student:-MultivariateCalculus):
A := [0, 0, 0];
B := [a, 0, 0];
C := [a, b, 0];
D := [0, b, 0];
S := [0, 0, h];
O := [x, y, z];
lineSC := Line(S, C);
lineSD := Line(S, D);
H := Projection(A, lineSC);
K := Projection(A, lineSD);
OH := H - O;
OK := K - O;
OC := C - O;
M := Matrix([OH, OK, OC]);
E:=(C+D)/2;
F:=(C+H)/2;
p1:=Plane(E,convert(C-D,Vector));
p2:=Plane(F,convert(C-H,Vector));
Eq1:=GetRepresentation(p1);
Eq2:=GetRepresentation(p2);
Md:=LinearAlgebra:-Determinant(M);
solve({Eq1,Eq2,Md}, {x,y,z});
O := eval(O, %);
d:=simplify(Distance(O, H));
d1:=simplify(Distance(O, K));
is(d=d1);

A := [0, 0, 0]

 

B := [a, 0, 0]

 

C := [a, b, 0]

 

D := [0, b, 0]

 

S := [0, 0, h]

 

O := [x, y, z]

 

Student:-MultivariateCalculus:-Line([0, 0, h], Vector(3, {(1) = a, (2) = b, (3) = -h}), variables = [x, y, z], parameter = t, id = 1)

 

Student:-MultivariateCalculus:-Line([0, 0, h], Vector(3, {(1) = 0, (2) = b, (3) = -h}), variables = [x, y, z], parameter = t, id = 2)

 

H := [h^2*a/(a^2+b^2+h^2), h^2*b/(a^2+b^2+h^2), h*(a^2+b^2)/(a^2+b^2+h^2)]

 

K := [0, h^2*b/(b^2+h^2), h*b^2/(b^2+h^2)]

 

OH := [-x+h^2*a/(a^2+b^2+h^2), -y+h^2*b/(a^2+b^2+h^2), -z+h*(a^2+b^2)/(a^2+b^2+h^2)]

 

OK := [-x, -y+h^2*b/(b^2+h^2), -z+h*b^2/(b^2+h^2)]

 

OC := [-x+a, -y+b, -z]

 

Matrix(3, 3, {(1, 1) = -x+h^2*a/(a^2+b^2+h^2), (1, 2) = -y+h^2*b/(a^2+b^2+h^2), (1, 3) = -z+h*(a^2+b^2)/(a^2+b^2+h^2), (2, 1) = -x, (2, 2) = -y+h^2*b/(b^2+h^2), (2, 3) = -z+h*b^2/(b^2+h^2), (3, 1) = -x+a, (3, 2) = -y+b, (3, 3) = -z})

 

E := [(1/2)*a, b, 0]

 

F := [h^2*a/(2*(a^2+b^2+h^2))+(1/2)*a, h^2*b/(2*(a^2+b^2+h^2))+(1/2)*b, h*(a^2+b^2)/(2*(a^2+b^2+h^2))]

 

Student:-MultivariateCalculus:-Plane(Vector(3, {(1) = a, (2) = 0, (3) = 0}), [(1/2)*a, b, 0], variables = [x, y, z], id = 1)

 

_m2776775710912

 

x = (1/2)*a

 

(-h^2*a/(a^2+b^2+h^2)+a)*x+(-h^2*b/(a^2+b^2+h^2)+b)*y-h*(a^2+b^2)*z/(a^2+b^2+h^2) = (-h^2*a/(a^2+b^2+h^2)+a)*((1/2)*h^2*a/(a^2+b^2+h^2)+(1/2)*a)+(-h^2*b/(a^2+b^2+h^2)+b)*((1/2)*h^2*b/(a^2+b^2+h^2)+(1/2)*b)-(1/2)*h^2*(a^2+b^2)^2/(a^2+b^2+h^2)^2

 

-h^2*a*(a^2*b*h-a^2*b*z-a^2*h*y+b^3*h-b^3*z-b^2*h*y)/((a^2+b^2+h^2)*(b^2+h^2))

 

{x = (1/2)*a, y = (1/2)*b*(b^2+2*h^2)/(b^2+h^2), z = (1/2)*h*b^2/(b^2+h^2)}

 

[(1/2)*a, (1/2)*b*(b^2+2*h^2)/(b^2+h^2), (1/2)*h*b^2/(b^2+h^2)]

 

(1/2)*(((b^2+h^2)*a^2+b^4)/(b^2+h^2))^(1/2)

 

(1/2)*(((b^2+h^2)*a^2+b^4)/(b^2+h^2))^(1/2)

 

true

(1)

 


 

Download center_circle.mw

In this example, it's easier to do it manually, using the empty symbol  ``   to prevent automatic bracket expansion:

restart;
p:=9*csc(theta)^2+9;
9*``(p/9);

 

evala(M);

 

You can use a special program for this. See  https://mapleprimes.com/posts/200677-Partition-Of-An-Integer-With-Restrictions

Examples of use:

Partition(10, 4, 1..4);  # Your problem.
``;
Partition(10, 4, {1,3,5,7,9});  # Partitions of length 4 consisting only of odd numbers.
``;
Partition(10, 1..10, {1,3,5,7,9});  # Any partitions of odd numbers.

         

 

 

A:=int(x^(1/2),x);
sqrt(A^2);

                                     

We used the fact that for any non-negative real number  A = sqrt(A^2) . This technique is often useful.

The  has(a, b)  command returns true if  b  is an operand of  of some level (in this case we say that  b  is a subexpression of  a ) . The operands are returned by the op command. See

restart;
A:=I/sqrt(a);
B:=op(A);
op(B[2]);
has(A,a^(-1/2));
has(A,-1/2);

                       

In the help for the  Algebraic:-Remainder(a, b, x, options) command it is written: "The arguments a and b must be univariate polynomials in the variable x, which is typically a name. If other names or non-algebraic sub-expressions are included and they cannot be evaluated to algebraic numbers, an "unable to divide multivariate polynomials" error will be returned". So use he standard command  rem :

restart;
rem(a*x^3 + b*x^2 + c*x + d, 3*a*x^2 + 2*b*x + c, x);

 

Use the  empty symbol  ``  for this.

Example:

restart;
plot(sqrt(x), x = 0 .. 4, tickmarks = [[seq(i=``,i=0..4)], [seq(i=``,i=0..2)]], scaling=constrained);

                               

restart;
expr:=factor(x^10/36 - 4/25*y^24*z^8);
r:=op(expr);
d:=r[1];
sort(``(sqrt(d)*r[2])*``(sqrt(d)*r[3]), x);

                    

 

 

It's very simple. You must write your code as a procedure with the parameter  xP , and then use the  plots:-animate command, specifying a range for the parameter  xP :

restart;
Proc:=proc(xP)
local xA, yA, xB, yB, yP;
uses plots,geometry;
_EnvHorizontalName := 'x';
_EnvVerticalName := 'y';
xA := 5;
yA := 0;
point(A, xA, yA);
xB := 5;
yB := -7;
point(B, xB, yB);
midpoint(C, A, B);
segment(sg1, A, B);

yP := 0;
point(P, xP, yP);
PerpenBisector(L, C, P);
line(YYp, y = yB);
line(XXp, y = 0);
intersection(M, L, YYp);
line(PM, [P, M]);
projection(H, C, PM);
triangle(CMP, [C, M, P]);
triangle(ABH, [A, B, H]);
distance(B, H);
circle(cir, [B, 7]);
display(textplot([[coordinates(A)[], "A"], [coordinates(B)[], "B "], [coordinates(C)[], "C"], [coordinates(M)[], "M"], [coordinates(H)[], "H"], [coordinates(P)[], "P"]], align = {"above", 'right'}),
draw([YYp(color = red), XXp(color = black), PM(color = green), L(color = green), sg1(color = black), cir(color = magenta), P(color = black, symbol = solidcircle, symbolsize = 10), M(color = black, symbol = solidcircle, symbolsize = 10), H(color = black, symbol = solidcircle, symbolsize = 10), A(color = blue, symbol = solidcircle, symbolsize = 10), B(color = blue, symbol = solidcircle, symbolsize = 10), CMP(color = blue, filled = true, transparency = 0.8), ABH(color = red, filled = true, transparency = 0.8), C(color = blue, symbol = solidcircle, symbolsize = 10)]),
axes = none, view = [-15 .. 14, -15 .. 3]);
end proc:

plots:-animate(Proc, [a], a=-12..12, frames=90);

     

Also we can use the Explore command:

Explore(Proc(xP), xP=-12..12);

     

 

When specifying a function using the arrow, you must specify the function name. Your function names will be y1 and y2, not y1(x) and y2(x).
Also, your expression is somewhat better simplified with the  combine  command rather than the  simplify.

y1 := proc (x) options operator, arrow; 2*sin(x)-sin(2*x)+cos(2*x) end proc; y2 := proc (x) options operator, arrow; 4*sin(x)+sin(2*x)-cos(2*x) end proc; diff(y1(x), x); Expr := 1/2*((diff(y1(x), x))^2+(diff(y2(x), x))^2)+1/2*(3*y1(x)^2-y1(x)*y2(x)+y2(x)^2); simplify(Expr); combine(Expr)

33/2+(3/2)*sin(4*x)+(5/2)*sin(3*x)+(5/2)*cos(3*x)+(3/2)*cos(x)+(3/2)*sin(x)

(1)

NULL

Download simplify_expression_new.mw

I think this example reveals a serious bug in the  isolve  command that may appear in other examples. Let's consider a very simple example: find all integer solutions to the equation (x - y)*z = 1  . Obviously, the product of two integers is equal to 1 if and only if both factors are equal to 1 or both factors are equal to -1, that is, we obtain the set of two systems  {x - y = 1, z = 1}  or  {x - y = -1, z = -1} . But Maple only solves the first system and for some reason ignores the second one:

isolve((x-y)*z=1);

                      {x = _Z1+1, y = _Z1, z = 1}

Your problem has infinitely many solutions (see result of the  solve  command)). As an example at the end we find 1 solution:

restart;
A:=Matrix(3,symbol=x);
B:=A^2-A;
convert(B, set);
Sol:=solve(%); # All the solutions
X:=Sol[1];
L:=[x[2,1]=1,x[3,1]=2,x[3,2]=3,x[3,3]=4];
Y:=eval(X, L);
A:=eval(A,[L[],Y[]]); # 1 solution
A^2-A; # Check

Matrix(3, 3, {(1, 1) = x[1, 1], (1, 2) = x[1, 2], (1, 3) = x[1, 3], (2, 1) = x[2, 1], (2, 2) = x[2, 2], (2, 3) = x[2, 3], (3, 1) = x[3, 1], (3, 2) = x[3, 2], (3, 3) = x[3, 3]})

 

Matrix(3, 3, {(1, 1) = x[1, 1]^2+x[1, 2]*x[2, 1]+x[1, 3]*x[3, 1]-x[1, 1], (1, 2) = x[1, 1]*x[1, 2]+x[1, 2]*x[2, 2]+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2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[1, 3] = -x[3, 3]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[2, 1] = x[2, 1], x[2, 2] = x[2, 1]*x[3, 2]/x[3, 1], x[2, 3] = x[2, 1]*x[3, 3]/x[3, 1], x[3, 1] = x[3, 1], x[3, 2] = x[3, 2], x[3, 3] = x[3, 3]}, {x[1, 1] = -(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1], x[1, 2] = -x[3, 2]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3])/x[3, 1]^2, x[1, 3] = -(x[2, 1]*x[3, 2]*x[3, 3]+x[3, 1]*x[3, 3]^2-x[2, 1]*x[3, 2]-x[3, 1]*x[3, 3])/x[3, 1]^2, x[2, 1] = x[2, 1], x[2, 2] = (x[2, 1]*x[3, 2]+x[3, 1])/x[3, 1], x[2, 3] = x[2, 1]*(x[3, 3]-1)/x[3, 1], x[3, 1] = x[3, 1], x[3, 2] = x[3, 2], x[3, 3] = x[3, 3]}, {x[1, 1] = -x[2, 2]+1, x[1, 2] = -x[2, 2]*(x[2, 2]-1)/x[2, 1], x[1, 3] = -x[2, 3]*(x[2, 2]-1)/x[2, 1], x[2, 1] = x[2, 1], x[2, 2] = x[2, 2], x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 0}, {x[1, 1] = -x[2, 2]+1, x[1, 2] = -x[2, 2]*(x[2, 2]-1)/x[2, 1], x[1, 3] = -x[2, 3]*x[2, 2]/x[2, 1], x[2, 1] = x[2, 1], x[2, 2] = x[2, 2], x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 1}, {x[1, 1] = 1, x[1, 2] = -x[1, 3]*x[3, 3]/x[2, 3], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = -x[3, 3]+1, x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = -x[3, 3]*(x[3, 3]-1)/x[2, 3], x[3, 3] = x[3, 3]}, {x[1, 1] = 1, x[1, 2] = x[1, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 0}, {x[1, 1] = 1, x[1, 2] = x[1, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = -x[1, 2]/x[1, 3], x[3, 3] = 0}, {x[1, 1] = 1, x[1, 2] = 0, x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 0}, {x[1, 1] = 1, x[1, 2] = 0, x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 1}, {x[1, 1] = 1, x[1, 2] = x[1, 2], x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 1}, {x[1, 1] = 0, x[1, 2] = -x[1, 3]*(x[3, 3]-1)/x[2, 3], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = -x[3, 3]+1, x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = -x[3, 3]*(x[3, 3]-1)/x[2, 3], x[3, 3] = x[3, 3]}, {x[1, 1] = 0, x[1, 2] = 0, x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 0}, {x[1, 1] = 0, x[1, 2] = x[1, 3]*x[3, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 1}, {x[1, 1] = 0, x[1, 2] = x[1, 2], x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 0}, {x[1, 1] = 0, x[1, 2] = x[1, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 1}

 

X := {x[1, 1] = -(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1], x[1, 2] = -x[3, 2]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[1, 3] = -x[3, 3]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[2, 1] = x[2, 1], x[2, 2] = x[2, 1]*x[3, 2]/x[3, 1], x[2, 3] = x[2, 1]*x[3, 3]/x[3, 1], x[3, 1] = x[3, 1], x[3, 2] = x[3, 2], x[3, 3] = x[3, 3]}

 

L := [x[2, 1] = 1, x[3, 1] = 2, x[3, 2] = 3, x[3, 3] = 4]

 

Y := {1 = 1, 2 = 2, 3 = 3, 4 = 4, x[1, 1] = -9/2, x[1, 2] = -27/4, x[1, 3] = -9, x[2, 2] = 3/2, x[2, 3] = 2}

 

Matrix(3, 3, {(1, 1) = -9/2, (1, 2) = -27/4, (1, 3) = -9, (2, 1) = 1, (2, 2) = 3/2, (2, 3) = 2, (3, 1) = 2, (3, 2) = 3, (3, 3) = 4})

 

Matrix(%id = 18446746597940595758)

(1)

 


 

Download Matrix_equation.mw

1 2 3 4 5 6 7 Last Page 3 of 284