Kitonum

21495 Reputation

26 Badges

17 years, 58 days

MaplePrimes Activity


These are answers submitted by Kitonum

The procedure  Fourier  solves your problem. Formal arguments:  f  is original function,  if you need the whole series then  n  is  infinity ,  if the partial sum then  n  is nonnegative integer.

Fourier:=proc(f, n::{nonnegint, infinity})

local a0, a, b;

a0:=(1/(2*Pi))*(int(f(x),x=-Pi..Pi));

a:=k->(1/Pi)*(int(f(x)*cos(k*x),x=-Pi..Pi, AllSolutions) assuming k::posint);

b:=k->(1/Pi)*(int(f(x)*sin(k*x),x=-Pi..Pi, AllSolutions) assuming k::posint);

if n=infinity then return a0+Sum(simplify(a(k)*cos(k*x)+b(k)*sin(k*x), assume=k::posint) , k=1..n) else a0+add(a(k)*cos(k*x)+b(k)*sin(k*x), k=1..n)  fi;

end proc;

 

Examples:

f := x->min(abs(x), (1/2)*Pi);

Fourier(f, infinity);

Fourier(f, 5);

 

plot([f(x), seq(Fourier(f, k), k = [1, 2, 3, 5, 6, 30])], x = -Pi .. Pi, thickness = [3, `$`(1, 6)], color =

 [blue, red, brown, khaki, yellow, green, violet], scaling = constrained);

 

 PS.  For the violet  curve (k = 30)  the plot is indistinguishable from the original one.

Edited: The code is corrected.

 

A:=1/2*pochhammer(1-n,n):

eval(A, n=0), eval(A, n=k) assuming k::posint;

                                  1/2,  0

plots[implicitplot](y*(1-x-y)>=0, x=0..1, y=0..1,  coloring=[green, white], filledregions, numpoints=10000, view=[-0.5..1.5, -0.5..1.5]);

 

 

sort([[2,1],[3,2],[5,3],[1,4],[4,5]], (a,b)->is(a[1]<=b[1]));

                     [[1, 4], [2, 1], [3, 2], [4, 5], [5, 3]]

Replace the penultimate line of your code by

sort([seq(B[i], i=1..3)], proc (x, y) options operator, arrow; is(y[2] < x[2]) end proc);

L:=[[0,2,3,0,0], [2,3,0,0,0], [1,1,2,2,0], [2,2,1]]:

convert(map(x->1/mul(x[i]!, i=1..nops(x)), L), `+`);

                                        2/3

B1:=[2., 36.718220544331125]:

B2:=[2., 35.08378362904457]:

B3:=[2., 51.78712780854305]:

sort([B1, B2, B3], (x,y)->is(x[2]>y[2]));

datamax:=%[1];

 

 

Why do you think that  w*exp(z)  is   the wrong value? Compare 2 plots

restart;

A := plot3d(sum((sum(binomial(2*q, n-1)*z^q/factorial(q), q = 0 .. infinity))*w^n, n = 1 .. infinity), z = 0 .. 5, w = 0 .. 5):

B := plot3d(exp(z)*w, z = 0 .. 5, w = 0 .. 5):

plots[display](<A | B>);

 

 

 

 
 

  

 

The procedure  Jacobi  takes one step in Jacobi's method:

Jacobi:=proc(A::Matrix)

local n, a, i, j, p, c, s, T;

uses LinearAlgebra;

n:=RowDimension(A);

a:=[[0,0], 0];

for i to n do

for j from i+1 to n do

if abs(A[i,j])>=abs(a[2]) then a:=[[i,j], A[i,j]] fi;

od;  od;

p:=2*a[2]/(A[a[1,1],a[1,1]]-A[a[1,2],a[1,2]]);

c:=evalf(cos(arctan(p)/2));

s:=evalf(sin(arctan(p)/2));

T:=Matrix(n,{op(subsop(a[1,1]=((a[1,1],a[1,1])=c), a[1,2]=((a[1,2],a[1,2])=c),[seq((i,i)=1, i=1..n)])), (a[1,1],a[1,2])=-s, (a[1,2],a[1,1])=s});

Transpose(T).A.T;

end proc:

 

Example (done 20 iterations):

A:=Matrix(4, [1,2,3,4,2,5,5,6,3,5,7,7,4,6,7,8]);

(Jacobi@@20)(A);

 

 

Consider the solution in Maple with a partially manual solution:

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

g := unapply(Pi*(x-2)/(4*x^2-4*x+2), x);

Expr := simplify(eval(2*sin((u-v)*(1/2))*cos((u+v)*(1/2)), {u = f(x), v = Pi/2-g(x)}));

 

 

Sol1:=[solve(op([2, 1], Expr) = (1/2)*Pi+Pi*k, x)];

Sol2:=[solve(op([3, 1], Expr) = (1/2)*Pi+Pi*k, x)];

 

 

S1:=isolve(-2*k-4*k^2>=0);

S2:=isolve(5+16*k-16*k^2>=0);

 

 

{op(eval(Sol1, S1)),op(eval(Sol2, {op(S2[1])})), op(eval(Sol2, {op(S2[2])}))} ;

 

 

First you have to call the package by the command:

with(Student[Calculus1]):

 

See your inequality

log[3+sqrt(8)](3-x)-log[17-6*sqrt(8)](4*x^2+20*x+25)+log[3-sqrt(8)](x^2+x-2)>=0;

 

It is easy to check the following equalities:

1)  17-12*sqrt(2)=(3-2*sqrt(2))^2

2)  3-2*sqrt(2)=1/(3+2*sqrt(2))

 

With these equalities your inequality is easily simplified and Maple solves it:

solve(ln(3-x)+ln(4*x^2+20*x+25)/2-ln(x^2+x-2)>=0);

Only one bug: in fact  1-sqrt(14)-sqrt(51)/3  and  sqrt(51)/3  are the roots.

 

PS.  Mathematica correctly solves this inequality directly:

 

 

Rotation matrix makes it easy to find the coordinates of the image of a vector under rotation. If you want to find the coordinates of a point under rotation around a straight line, it is more convenient to use the  geom3d[rotation]  command. Student[LinearAlgebra][RotationMatrix]  command can also be used for solving of this problem.

Useful exercise - find the coordinates of the point  [4,2,5]  while rotating around a line passing through the point  [1,2,3] with direction vector  <1,1,1>   through  angle  Pi/3  in two ways:

1) By  geom3d[rotation]  command.

2) By  Student[LinearAlgebra][RotationMatrix]  command.

RootFinding[Analytic](exp(x)*cos(x)+1=0, re=0..10, im=-1..1);

        4.7033237594522, 1.7461395304080, 7.8543696865740

IsIntersect:=proc(Seg1, Seg2)

if solve({Seg1[1,1]*t+Seg1[2,1]*(1-t)=Seg2[1,1]*s+Seg2[2,1]*(1-s), Seg1[1,2]*t+Seg1[2,2]*(1-t)=Seg2[1,2]*s+Seg2[2,2]*(1-s), t>=0, t<=1, s>=0, s<=1}, {t,s})=NULL

then return false else true fi;

end proc: 

 

Examples:

IsIntersect([[1,1],[2,2]], [[2,1],[1,2]]);

IsIntersect([[2,2],[3,3]], [[2,1],[1,2]]);

                                  true

                                  false

First 254 255 256 257 258 259 260 Last Page 256 of 290