a few Maple10/11 projects Wave Deconstruct / reconstruct Is/If with Assuming in Maple A Maple coffee table Calculate area between two curves HTML color codes using Maple
get Maple 11 ! WaveDeconstruct.mw  ( Maple 11 worksheet archive ) updated 5-13-07 



Deconstructing a wave into it's various components. It was a lot of fun and really simple doing this with  Maple 11 !
It's a little sloppy - actually it's really sloppy. I'll try to clean it up later

 
Typesetting:-mrow(Typesetting:-mi( 
`:=`(freqArray, Array(1 .. 100)); -1; `:=`(expressionArray, Array(1 .. 100)); -1; `:=`(ampArray, Array(1 .. 100)); -1 
 
#================================================================ 
#Create a bunch of waves of various frequencies and add them together to create a complicated wave.
#I'm using only sine waves here, but it would be just as easy to mix in cosine.
#================================================================ 
`:=`(p1, `+`(`*`(2, `*`(sin(`+`(`*`(2, `*`(x)))))))); -1`:=`(p2, `+`(`*`(.5, `*`(sin(`+`(`*`(3, `*`(x)))))))); -1`:=`(p3, sin(`+`(`*`(15, `*`(x))))); -1`:=`(p4, `+`(`*`(22, `*`(sin(`+`(`*`(33, `*`(x)))))))); -1; `:=`(p5, `+`(`*`(21, `*`(sin(`+`(`*`(54, `*`(x)))))))); -1; `:=`(p6, `+`(`*`(27, `*`(sin(`+`(`*`(66, `*`(x)))))))); -1; `:=`(p7, `+`(`*`(20,...
`:=`(p4, `+`(`*`(22, `*`(sin(`+`(`*`(33, `*`(x)))))))); -1; `:=`(p5, `+`(`*`(21, `*`(sin(`+`(`*`(54, `*`(x)))))))); -1; `:=`(p6, `+`(`*`(27, `*`(sin(`+`(`*`(66, `*`(x)))))))); -1; `:=`(p7, `+`(`*`(20,...
`:=`(p4, `+`(`*`(22, `*`(sin(`+`(`*`(33, `*`(x)))))))); -1; `:=`(p5, `+`(`*`(21, `*`(sin(`+`(`*`(54, `*`(x)))))))); -1; `:=`(p6, `+`(`*`(27, `*`(sin(`+`(`*`(66, `*`(x)))))))); -1; `:=`(p7, `+`(`*`(20,...
 
`+`(`*`(2, `*`(sin(`+`(`*`(2, `*`(x)))))), `*`(.5, `*`(sin(`+`(`*`(3, `*`(x)))))), sin(`+`(`*`(15, `*`(x)))), `*`(22, `*`(sin(`+`(`*`(33, `*`(x)))))), `*`(21, `*`(sin(`+`(`*`(54, `*`(x)))))), `*`(27, ...

plot(pAll, x = `+`(`-`(Pi)) .. Pi, title =  
Plot_2d

 
#============================================== 
#Deconstruct the complicated wave into maple wave expression, frequency
# & amplitude of each individual wave that makes up the complicated wave
 
#============================================== 
 
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = 
`+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
`:=`(myIndex, 1); -1; for i to 100 do if `<>`(int(`*`(sin(`*`(i, `*`(x))), `*`(pAll)), x = `+`(`-`(Pi)) .. Pi), 0) then `:=`(freqArray[myIndex], i); `:=`(expressionArray[myIndex], sin(`*`(i, `*`(x))))...
 


 
#========================================================== 
#print out the freq, amplitude, and plots of the various waves comprising the complicated wave at top 
#========================================================== 
 
Typesetting:-mrow(Typesetting:-mi( 
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
for i to 8 do if `<>`(myNewArray[i], 0) then printf(
 

freq:  2Hz.        amplitude: 2
Plot_2d

freq:  3Hz.        amplitude: 1
Plot_2d

freq:  15Hz.        amplitude: 1
Plot_2d

freq:  33Hz.        amplitude: 22
Plot_2d

freq:  54Hz.        amplitude: 21
Plot_2d

freq:  66Hz.        amplitude: 27
Plot_2d

freq:  75Hz.        amplitude: 20
Plot_2d
freq:  85Hz.        amplitude: 20
Plot_2d

Typesetting:-mrow(Typesetting:-mi( 
for i to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i]))); `:=`(bFound, true); `:=`(bFoundAt, i); break end if end do
for i to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i]))); `:=`(bFound, true); `:=`(bFoundAt, i); break end if end do
for i to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i]))); `:=`(bFound, true); `:=`(bFoundAt, i); break end if end do
for i to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i]))); `:=`(bFound, true); `:=`(bFoundAt, i); break end if end do
for i to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i]))); `:=`(bFound, true); `:=`(bFoundAt, i); break end if end do
 
 
 
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`
(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
if bFound then for i from bFoundAt to 8 do if `<>`(myNewArray[i], 0) then `:=`(pAllNew, `+`(pAllNew, `*`(ceil(evalf(ampArray[i])), `*`(expressionArray[i])))) end if end do; plot(pAllNew, x = `+`(`-`(P...
 
Plot_2d