Kitonum

21440 Reputation

26 Badges

17 years, 33 days

MaplePrimes Activity


These are answers submitted by Kitonum

restart;

D[1](u)(1,t)=0;

eval(diff(u(x,t),x), x=1)=0;

 

 

Example:

u:=(x,t)->x^2+3*x*t+t^3;

D[1](u)(1,t);

eval(diff(u(x,t),x), x=1);

 

 

PP->Insert->Video->Video from file->All Files->Insert

eq1 := x1*a+x2*a+x3*a+x4*a+z = 0:

eq2 := x1+x2+x3+x4 = m:

soln := solve([eq1, eq2], {x1, x2, x3, x4, z});

%[-1];

 

 

From the plot, using the mouse, find the approximate values ​​of the roots, and then use Student[NumericalAnalysis][Newton] :

f := 4*x*cos(3*x)+(x-2)^2-2:

plot(f, x = -5 .. 10);

map2(Student[NumericalAnalysis][Newton], f, map(t->x = t, [0.5, 1.6, 2.5, 3.6, 4.8, 5.6, 7.1, 7.4]));

 

Easier to find all the roots, if you use  RootFinding[Analytic]  command :

sort([RootFinding[Analytic](f, x, re = 0 .. 10, im = -0.1 .. 0.1)]); 

 

 

restart;

f:=(x,y)->2+x^2 +1/4*(y^2);

Px, Py:=1, 2;

DPx, DPy:=D[1](f)(Px,Py), D[2](f)(Px,Py);  # Partial derivatives

maximize(DPx*cos(alpha)+DPy*sin(alpha), location);  # Maximum of directional derivative

A:=plot3d(f(x,y), x=-1..3, y=0..4, axes=normal):

B:=plots[arrow]([Px,Py,0],[DPx,DPy,0], color=red):

plots[display](A,B, orientation=[-15,65]);

 

 

The length of the gradient vector (the red arrow) is equal to the maximum of the directional derivative, that is  sqrt(5) . The arrow shows the direction of the steepest increase of the function  f(x,y) .

See help page in Maple  Statistics/Regression

Another way is to use  piecewise  command from the outset. This method without a mouse, I think the most comfortable.

piecewise(x<0, x-1, x=0, 0, x>0, x+1);

 

 

plot(%, t=0..1,  discont, axes=box);   # zero, except in t=1

Var := indets(EQ):

A, V := LinearAlgebra[GenerateMatrix](EQ, Var);

evalf(LinearAlgebra[LinearSolve](A, V));

 

 

B:=cos(x)^2*sqrt(1-1/4*(3*sin(x)^2*cos(y)^2+cos(x)^2));

evalf(Int(B, [x=0..7*Pi/18, y=0..2*Pi]));

 List of errors:

1) Coding of  Pi .

2) Signs of multiplication.

3) Value of the function to the power  n  should be  f(x)^n  rather than  f^n (x) .

4) For double integrals ranges should be in brackets  [x=x1..x2, y=y1..y2] 

 

GAMMA  is the specific function in Maple, gamma is Euler's constant. See help for details.

 

evalf(gamma);

GAMMA(5);

               0.5772156649

                       24

ArePermutable:=proc(A::Matrix, B::Matrix)

local m, n, m1, n1, Rows, L, M, Columns, L1, K;

uses LinearAlgebra, combinat;

m:=RowDimension(A); n:=ColumnDimension(A); m1:=RowDimension(B); n1:=ColumnDimension(B);

if m<>m1 or n<>n1 then error "Matrices should be the same size" fi;

Rows:=permute([seq(A[i], i=1..m)]); L:=[seq(<op(Rows[i])>, i=1..m!)];

for M in L do

Columns:=permute([seq(M[..,i], i=1..n)]); L1:=[seq(<`<|>`(op(Columns[i]))>, i=1..n!)];

for K in L1 do

if Equal(K,B) then return true fi;

od; od;

false;

end:

 

Examples of use:

A:=<1,2,3; 4,5,6; 7,8,9>;  B:=<3,2,1; 9,8,7; 6,5,4>; C:=<2,1,3; 4,5,6; 7,8,9>;

ArePermutable(A,B);  ArePermutable(A,C);

 

 

Simple procedure  PartitionIntoPrimes  gives all possible partitions of a natural number  a  into  n  prime summands. By default, the procedure returns the list of lists of all partitions. If the third argument of the procedure is any symbol, then the procedure returns all of the corresponding sums. The procedure was written in Maple 12 classic.

PartitionIntoPrimes:=proc(a::posint, n::posint, s::symbol:=list)

local L, M, k, i, S, S1;

uses numtheory, combinat;

L:=[seq(ithprime(k)$n, k=1..pi(a))];

M:=choose(L, n); k:=0;

for i in M do

if `+`(op(i))=a then k:=k+1; S[k]:=i; fi;

od;

S:=convert(S, list):

if s=list then return S else S1:=map(t->`+`(op(map(x->``(x),t)))=a, S) fi;

for i in S1 do

print(i);

od;

end:

 

Examples of use:

PartitionIntoPrimes(30, 2);

PartitionIntoPrimes(30, 6);

PartitionIntoPrimes(30, 6, s);

 

 

 

f := simplify(evalc(int(cosh(a*x)*cos(b*x), x)));

 

 Addition:

simplify(convert(f, trig));

 

 

I made ​​some changes in your code. Write if you got what you wanted?

restart:

alias(C=binomial):

HybrFunc:=proc(N, M,tj)  # N=Number of subintervals,  M=Number of functions in subintervals

local B, i, kk, j1, w, aa, bb, OB;

global b; 

B:=(i,M,t) -> C(M,i)*(1-t)^(M-i)*t^i;

w[0]:=B(0,M,t);

for i from 0 to M

do

  kk:=0; 

  for j1 from 0 to i-1

  do

    aa[j1]:=int(B(i,M,t)*w[j1],t=0..1);

    bb[j1]:=int(w[j1]^2,t=0..1);

    kk:=kk+aa[j1]/bb[j1]*w[j1];

  od;

w[i]:=simplify(B(i,M,t)-kk);

w[i]/sqrt(int(w[i]^2,t=0..1));

OB[i]:=unapply(%,t);

od; 

b:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, sqrt(N)*OB[m](N*t-(n-1)*tj), 0),n,m); 

simplify(Array(1..N, 0..M , b));

end proc:

 

Example: 

HybrFunc(2, 3, 1);

First 230 231 232 233 234 235 236 Last Page 232 of 289