kiraMou

45 Reputation

4 Badges

3 years, 308 days

MaplePrimes Activity


These are questions asked by kiraMou

FourTrans.mwI am wondering if I can calculate this Fourier Transfrom analytically using Maple:

Hey everyone!

I have a complex function stored in a file (Comp-func.txt). The function is continues everywhere on the real axis (X-axis.txt). However, its log shows a jump somewhere close to x=-1.5. I would like to understand how Maple interprets this "jump" and how to avoid such numerical artifact.

thank you.

 Comp-func.txt

Jump-Log-Func.mw

X-axis.txt

Hey everyone!

I am trying to merge two vectors into a matrix. Let us say that both of the vectors has only one line and 4 columns:
A:=[a1,a2,a3];B:=[b1,b2,b3,b4];
Therefore, the matrix that I am trying to get should have this form:
M=Matrix([[a1,b1,0,0,0,0,0,0],[0,0,a2,b2,0,0,0,0],[0,0,0,0,a3,b3,0,0],[0,0,0,0,0,0,a4,b4]]);
Thanks in advance!

restart; N := 100; dx := evalf(2*Pi/N)

100

 

0.6283185308e-1

(1)

f1 := proc (x) options operator, arrow; sin(x) end proc;

proc (x) options operator, arrow; sin(x) end proc

(2)

DiscX := proc (N, dx) local i, xv; xv := Vector(N); for i to N do xv[i] := evalf((i-(1/2)*N-1)*dx) end do; return xv end proc:

Xfun := proc (f1) local i, xa1, xa2; xa1 := Vector(N); xa2 := Vector(N); for i to N do xa1[i] := evalf(subs(x = a[i], f1(x))) end do; return xa1 end proc:

IntNum := proc (N, a, c) local i, xv1; xv1 := Vector(N); for i from 2 to N-1 do xv1[i] := evalf((1/2)*(a[i]-a[i+1])*(c[i]+c[i+1])) end do; return xv1 end proc:

a := DiscX(N, dx); a[1]; a[100]

a := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

-3.141592654

 

3.078760801

(3)

c := Xfun(f1); c[1]

c := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

0.4102067615e-9

(4)

k := IntNum(N, a, c)

k := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(5)

plot([seq([a[i], k[i]], i = 2 .. N)], style = line, title = typeset("Integ_of_sin(x)"), titlefont = [times, bold, 30]);

 

``

Download test.mw

Hey everyone!

I would like to plot the integral of a discrete function. For simplicity, I choose the function sin(x) between –Pi and Pi, which has as an integral -cos(x). I tried to implement that in Maple using the Trapezoidal rule, but the result is simply wrong. Any help would be much appreciated!

Hello everyone !,


I would like to generate two random complex vectors (x1 and x2) several time and I want to check how these two vectors (j iteration) close to their previous values (j-1 iteration): abs (x1(j)-x1(j-1)) < 10^-4 and abs (x2(j)-x2(j-1)) < 10^-4. Therefore, I want that my program stop when this criteria is satisfied for x1 and x2 simultaneously.

I know how to check that for one element of the vector but not all the elements of the vector.
code:
Comp.vect.mw

1 2 3 Page 1 of 3