Kitonum

21525 Reputation

26 Badges

17 years, 74 days

MaplePrimes Activity


These are answers submitted by Kitonum

acer's way makes sense for a single application. But if this needs to be done several times, then a more significant gain (for arbitrary matrices) is given by applying the procedure:
 

Cs:=A->[seq(A[..,i],i=1..op([1,2],A))];

proc (A) options operator, arrow; [seq(A[() .. (), i], i = 1 .. op([1, 2], A))] end proc

(1)

A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);
Cs(A);

Matrix(4, 5, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 1, (1, 4) = 3, (1, 5) = 2, (2, 1) = 3, (2, 2) = 4, (2, 3) = 9, (2, 4) = 0, (2, 5) = 7, (3, 1) = 2, (3, 2) = 3, (3, 3) = 5, (3, 4) = 1, (3, 5) = 8, (4, 1) = 2, (4, 2) = 2, (4, 3) = 8, (4, 4) = -3, (4, 5) = 5})

 

[Vector[column](%id = 18446747312617452598), Vector[column](%id = 18446747312617452718), Vector[column](%id = 18446747312617452838), Vector[column](%id = 18446747312617452958), Vector[column](%id = 18446747312617453078)]

(2)

 


 

Download Columns.mw

restart;
Eq:=x^2-3=0:
f:=unapply(lhs(Eq), x);
x0:=3.:
for n from 1 do
x||n:=x||(n-1)-f(x||(n-1))/D(f)(x||(n-1));
if abs(x||n-x||(n-1))<10^(-6) then break fi;
od;

sqrt(3.);  # for comparison

          

 

 

When working with expressions with a small denominator (you have  a=10^(-10) ), increased precision is required. You are working with  Digits=10  by default. If you take for example  Digits:=25 , then the difference in results disappears:


 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2018.2, Windows 10, October 23 2018 Build ID 1356656`

(1)

KL := (a, b) -> (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*a*b)/a

proc (a, b) options operator, arrow; (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*b*a)/a end proc

(2)


Digits:=25:
evalf(KL(1e-10, 1/2));

-.3465735902646299

(3)

evalf(KL(1e-10, 0.5))

-.3465735902646300000000000

(4)

 


 

Download I_am_lost_new.mw

This is not a continued fraction. You just need to rewrite the integrand as an infinite product  x^(1/2)*x^(1/4)*x^(1/8)* ...

So we get

int(product(x^(1/2^k), k=1..infinity), x);

                                     

Another way:
 

restart;
L:=[1/x, 3, 1, [0,t,t=0..4]]:
P:= plot(L,  x=-1..2, y=0..4, color=black, thickness=2):
Q:=plots:-implicitplot(y-1/x, x = 0 .. 1, y = 1 .. 3, coloring = ["SteelBlue", "White"], filledregions = true):
plots:-display(P,Q, scaling=constrained, size=[450,600]);

 

 

 


 

Download filledregions.mw

The procedure  P  saves from the list  L  only those pairs of entries  a  and  b  for which  abs(a - b)  equals the minimum distance  m  between the entries of the original list.


 

restart;
P:=proc(L::list(positive))
local n, L1, m, S, L2;
n:=nops(L);
L1:=sort(L);
m:=min(seq(L1[k]-L1[k-1],k=2..n));
S:={seq(`if`(L1[k]-L1[k-1]=m,op([L1[k-1],L1[k]]),NULL), k=2..n)};
select(x->evalb(x in S), L);
end proc:

# Examples
L:=[8.1 , 2.03 , 3.5 , 0.05 , 4.1]:
P(L);

L:=[8.1 , 7.5, 2.03 , 3.5 , 0.05 , 4.1]:
P(L);

[3.5, 4.1]

 

[8.1, 7.5, 3.5, 4.1]

(1)

 


 

Download P.mw

To calculate sums with specific numerical (not symbolic) limits, use the  add command instead of sum :

M:=<x[1]^2+x[2]^2,-x[1]^2-x[2]^2; -x[1]^2-x[2]^2,x[1]^2+x[2]^2>;

Matrix(2, 2, {(1, 1) = x[1]^2+x[2]^2, (1, 2) = -x[1]^2-x[2]^2, (2, 1) = -x[1]^2-x[2]^2, (2, 2) = x[1]^2+x[2]^2})

(1)

M[1,1];

x[1]^2+x[2]^2

(2)

diff(M[1,1],x[1]);

2*x[1]

(3)

diff(M[1,1],x[2]);

2*x[2]

(4)

add(diff(M[1,1],x[k])+diff(M[1,k],x[1])-diff(M[k,1],x[1]), k=1..2);

2*x[1]+2*x[2]

(5)

 


The above also shows how easy it is to enter a matrix using 1D input instead of 2D. No palettes needed.

Download add.mw

 

 

You missed the multiplication sign. Should be

V:= (4*Pi*(d/2)^3)/3;
eval(V, d = 6.35*мм);

                    
                 

In arrays, indexing can start with any integer. For example:

n:=Array(0..2, [1,2,3]);
n[0];

              n := Array(0 .. 2, {0 = 1, 1 = 2, 2 = 3})
                                            1

Use the  expand  command:


 

restart;

eq_4_34 := x__alpha = C*x__a - C/2 * (x__b + x__c);

x__alpha = C*x__a-(1/2)*C*(x__b+x__c)

(1)

eq_4_33 := x__0 = 1/3*(x__a + x__b + x__c);

x__0 = (1/3)*x__a+(1/3)*x__b+(1/3)*x__c

(2)

eq_4_33aux := X__sub = (x__b + x__c);

X__sub = x__b+x__c

(3)

attempt2 := algsubs((x__b + x__c) = X__sub, eq_4_33);

x__0 = (1/3)*x__a+(1/3)*X__sub

(4)

attempt3 := X__sub = solve(attempt2, X__sub);

X__sub = -x__a+3*x__0

(5)

eq_4_34x := x__alpha = algsubs((x__b + x__c) = 3*x__0 - x__a, rhs(eq_4_34));

x__alpha = -(1/2)*C*(-x__a+3*x__0)+C*x__a

(6)

eq_4_35 := x__a = simplify(solve(eq_4_34x, x__a));

x__a = (1/3)*(3*C*x__0+2*x__alpha)/C

(7)

expand(eq_4_35);
desired:= x__a = x__0 + (2*x__alpha)/(3*C);

x__a = x__0+(2/3)*x__alpha/C

 

x__a = x__0+(2/3)*x__alpha/C

(8)

 


 

Download Q20201005_2_new.mw

restart;
z:=x+I*y:
F:=evalc(abs(z+1)*abs(z-1)=1);
 plots:-implicitplot(F, x=-3..3, y=-3..3, gridrefine=3, scaling=constrained, size=[600,300]);

                   

     

1. To calculate derivatives at specific points, it is better to use the differentiation operator  D  than a combination of  diff  with  subs.
2. For a better perception of what this paraboloid looks like, it is necessary to reduce the ranges on all 3 axes.
3. Calculation confirms that the vertex of this paraboloid is (0, 0, -6).

restart;
f:=(x,y)->2*x^2+3*y^2-x*y-6;
D[1](f)(1,1); # The partial derivative by x in the point (1,1)
D[2](f)(1,1); # The partial derivative by y in the point (1,1)
p1:=plot3d(f(x,y), x=-3..3, y=-3..3, style=patchcontour, view=-7..6):
p2:=plots:-spacecurve([x,1,f(x,1)],x=-3..3, color=red, thickness=3):
p3:=plots:-spacecurve([1,y,f(1,y)],y=-3..3, color=blue, thickness=3):
plots:-display(p1,p2,p3, axes=normal);
minimize(f(x,y), x=-3..3, y=-3..3, location);

             

           

Download Q20201001_new.mw
 

restart;

Given_eq_3_37 := M = k_ * sqrt(L__1 * L__2);

M = k_*(L__1*L__2)^(1/2)

(1)

Given_eq_3_30 := k_ = sqrt((L__m)^2 / (L__1 * L__2p));

k_ = (L__m^2/(L__1*L__2p))^(1/2)

(2)

Given_eq_3_37a := combine(subs([Given_eq_3_30], Given_eq_3_37)) assuming L__1>0, L__2>0;

M = (L__2*L__m^2/L__2p)^(1/2)

(3)

 


 

Download Q20201001_new.mw

 

Use the option  free=...  , for example:


 

A := Matrix(4, 4, {(1, 1) = 1, (1, 2) = 3, (1, 3) = 4.5, (1, 4) = 7, (2, 1) = 0, (2, 2) = 2, (2, 3) = 5, (2, 4) = 9, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}); B := Vector(4, {(1) = 0, (2) = 0, (3) = 0, (4) = 0}); C := LinearAlgebra[LinearSolve](A, B, free = 't')

Vector[column](%id = 18446746219697584838)

(1)

W1 := C[1]; W2 := C[2]; W3 := C[3]; W4 := C[4]; Q := W1*x^4+W2*x^3+W3*x^2+W1

(HFloat(3.0)*t[2]+HFloat(6.5)*t[1])*x^4+(-HFloat(2.5)*t[2]-HFloat(4.5)*t[1])*x^3+t[2]*x^2+HFloat(3.0)*t[2]+HFloat(6.5)*t[1]

(2)

``

NULL


 

Download MultipleTCoefficients_new.mw

 

In your worksheet the function  F  was not defined correctly. Here's the revised version:


 

restart

with(LinearAlgebra)

F := proc (x) options operator, arrow; x^2 end proc

F(u(t))

u(t)^2

(1)

for n from 0 while n <= 6 do V[n] := (diff(F(sum(t^i*u[i], i = 0 .. n)), [`$`(t, n)]))/factorial(n) end do

t := 0

0

(2)

for i from 0 while i <= n-1 do A[i] := V[i] end do

u[0]^2

 

2*u[0]*u[1]

 

2*u[0]*u[2]+u[1]^2

 

2*u[0]*u[3]+2*u[1]*u[2]

 

2*u[0]*u[4]+2*u[1]*u[3]+u[2]^2

 

2*u[0]*u[5]+2*u[1]*u[4]+2*u[2]*u[3]

 

2*u[0]*u[6]+2*u[1]*u[5]+2*u[2]*u[4]+u[3]^2

(3)

NULL

``


 

Download Adomian_Polynomials_new.mw

First 50 51 52 53 54 55 56 Last Page 52 of 290