## 148 Reputation

15 years, 238 days

## Converting Mathematica 6 code to maple 1...

Maple

Greetings All

I've had help creating some commands in mathematica 6 but prefer to use maple 11 (because maple just seems easier for me to use)  Does anyone know how I can convert mathematica 6 commands to maple 11 commands.  The following commands are below and an example of the ouput I'm trying to get with maple 11.

Mathematica 6 code

Input commands:

data ={{0,0},{.5,-1},{1,0},{2,2},{3,0},{4,-2.750000000},{5,-4},{6,-2.750000000},{7,0},

{8,2.937500000},{9,5.500000000},{10,7.312500000},{11,8},{12,7.312500000},

{13,5.5},{14,2.937500000},{15,0},{16,-2.918367347},{17,-5.346938775},

{18,-6.795918367},{18.5,-7},{19,-6.795918368},{20,-5.346938776},

{21,-2.918367347},{22,0},{23,2.84},{24,4.72},{24.5,5},{25,4.72},{26,2.84},{27,0}};

f = Interpolation[data, PeriodicInterpolation -> True];

<< "FourierSeries`"

s[x_] = N[
FourierTrigSeries[f[x], x, 31, FourierParameters -> {-1, 1/27}]]

discr = Interpolation[data /. {x_, y_} -> {x, y},
InterpolationOrder -> 0];

g[x_] = Piecewise[{{discr[x], 0 < x < 27}, {0, True}}];

Show[Plot[s[x], {x, 0, 27}, PlotStyle -> Red, PlotRange -> {-9, 10}],
Plot[g[x], {x, 0, 27}, Filling -> Axis],
ListPlot[data, Filling -> Axis, PlotRange -> {0, 27}]]

Output:

0.61887- 0.680232 Cos[0.232711 x] + 2.96293 Cos[0.465421 x] -
0.532024 Cos[0.698132 x] - 0.87105 Cos[0.930842 x] -
0.708467 Cos[1.16355 x] - 0.510603 Cos[1.39626 x] -
0.236222 Cos[1.62897 x] - 0.112403 Cos[1.86168 x] -
0.0682778 Cos[2.0944 x] - 0.0317201 Cos[2.32711 x] -
0.00399665 Cos[2.55982 x] + 0.0110171 Cos[2.79253 x] +
0.0150056 Cos[3.02524 x] + 0.0156793 Cos[3.25795 x] +
0.0122262 Cos[3.49066 x] + 0.00657111 Cos[3.72337 x] +
0.00432201 Cos[3.95608 x] + 0.00341808 Cos[4.18879 x] +
0.00370543 Cos[4.4215 x] + 0.00333083 Cos[4.65421 x] +
0.00210063 Cos[4.88692 x] + 0.00505182 Cos[5.11963 x] +
0.00866377 Cos[5.35234 x] + 0.0110508 Cos[5.58505 x] +
0.0103873 Cos[5.81776 x] + 0.00850073 Cos[6.05047 x] +
0.00811838 Cos[6.28319 x] + 0.00689916 Cos[6.5159 x] +
0.0069005 Cos[6.74861 x] + 0.00596679 Cos[6.98132 x] +
0.00358397 Cos[7.21403 x] + 2.25013 Sin[0.232711 x] -
4.51511 Sin[0.465421 x] + 0.380184 Sin[0.698132 x] +
0.461366 Sin[0.930842 x] + 0.0632479 Sin[1.16355 x] -
0.135095 Sin[1.39626 x] - 0.160692 Sin[1.62897 x] -
0.131694 Sin[1.86168 x] - 0.118779 Sin[2.0944 x] -
0.0966167 Sin[2.32711 x] - 0.0797548 Sin[2.55982 x] -
0.0599806 Sin[2.79253 x] - 0.0380326 Sin[3.02524 x] -
0.0247422 Sin[3.25795 x] - 0.0141664 Sin[3.49066 x] -
0.0078713 Sin[3.72337 x] - 0.0060369 Sin[3.95608 x] -
0.0062354 Sin[4.18879 x] - 0.00650479 Sin[4.4215 x] -
0.00560183 Sin[4.65421 x] - 0.00806245 Sin[4.88692 x] -
0.00982397 Sin[5.11963 x] - 0.00853789 Sin[5.35234 x] -
0.00582364 Sin[5.58505 x] - 0.00249366 Sin[5.81776 x] -
0.00125506 Sin[6.05047 x] - 0.0000310571 Sin[6.28319 x] +
0.000971067 Sin[6.5159 x] + 0.00160663 Sin[6.74861 x] +
0.00321022 Sin[6.98132 x] + 0.00388205 Sin[7.21403 x]

tia sal2

## Book on recursion tia sal2...

Greetings all

I'm looking for a book or free online source / video that helps explains/teaches recusions

tia sal2

## Question on array and recursion type of ...

Maple

Greetings All

Question on array and recursion type of calculations in maple 11 tia sal2

I have a procedure digitalrootxval which calculates part of the final x value

digitalrootxval := proc (n)
if n = 0 then
return 0
elif n = 1 then
return 1
else return modp(n-1, 9)+1
end if
end proc:

and I have two different procedure arrays that determine how the y value should be calculated. The first procedure array addfib:

## Creating Recurision in maple 11 tia sal2...

Maple

Greetings all I know I can get the odd numbers and even numbers using the following command

oddnum := seq(2*j+1, j = 0 .. 13);

1,3,5,7,9,.....

evennum := seq(2*j, j = 0 .. 13);

0,2,4,6,8,......

## maple 11 and arrays tia sal2...

Maple

Greetings All

When I run these commands

with(combinat, fibonacci);

modp(fibonacci(3)-1, 9)+1

I get the answer of 2

but when I run with these commands

the single digit modp doesn't work  Why is this?

 1 2 3 4 Page 3 of 4
﻿