Maple 2020 Questions and Posts

These are Posts and Questions associated with the product, Maple 2020

The uploaded worksheet attempts to determine arc lengths of an ellipse by two methods. Why do their results differ?

ArcLength_of_Ellipse.mw

I want to integrate the function int(1/(A^2 - B^2*cos(t))^(1/2), t = 0 .. 2*Pi), I get the correct solution, but I want to prevent all the "if" statements from appearing. I have tried to use "assume" but the if statement still does not disappear.  

Download Plot.mw

Is there any way to save "explore plot" in such a way that the slider of constants should appear in the extension file?

So that I can see the constant changing in the extension file too.

For example for an ellipsoid with principal axes 3, 2 and 1 along the x, y and z coordinate axes respectively, with center at the origin and truncated at x equals 1.

What math will reveal its center of mass and its moment of inertia for an axis of revolution through the center of mass and parallel to the y axis?

Hi

I wanted to know how to search a list of permutations given criteria: print the permutation(s) If the 4th element of each perm was equal to [C,Z} and the seventh was equal to [B,Y]

perm.mw

I tried to simplify this equation:

where Ts,Cf,Rf,Lg & L are Variables to equivelent equation in the form of:

                                                         (.....)Z3+(....)Z2+(.....)Z+(.........)      /   (.....)Z3+(....)Z2+(.....)Z+(.........)
                                                         

Hi professors,

Please can someone help me 
i want code of  function in maple to calculate values  of B(t), 

i have this matlab code

randn('state',100)          
T = 1; N = 5; dt = T/N;

dW = sqrt(dt)*randn(1,N);   
W = cumsum(dW)

but does not calculate B(0.25) and B(0.5)

Thanks,

Hi

Say I have 3 players on 2 teams. The teams play each other and there are 9 single [[A[s], B[s]], [A[s], B[m]], [A[s], B[w]], [A[m], B[s]], [A[m], B[m]], [A[m], B[w]], [A[w], B[s]], [A[w], B[m]], [A[w], B[w]]]matchups.

A, B, C & X, Y, Z. are the players. A and X are the strongest players, C and Z are the weakest.

Here's one: [[A,X],[B,Y],[C,Z],[A,Y],[B,Z],[C,X],[A,Z],[B,X],[C,Y]]

So i'm looking for some code to display all such permutations.

Carl came up with some code a while back which 'kind of' does it

P:= [A,B]:  S:= [s,m,w]:
[seq(rtable((1..nops(S)) $ nops(P), ()-> index~(P, S[[args]]), order= C_order))];
[[A[s], B[s]], [A[s], B[m]], [A[s], B[w]], [A[m], B[s]], [A[m], B[m]], [A[m], B[w]], [A[w], B[s]], [A[w], B[m]], [A[w], B[w]]]

I am trying to define a sum which is obtained from linked functions (which also contain the sum command). 

The problem is: if I modify the first function p and rerun the worksheet (except fot the restart command), then the changes do not affect the result. Does anyone know why? Thank you very much.
 

I start with this

restart

p := proc (i, j) options operator, arrow; sum('cat(A, _, i, j, k)', 'k' = 1 .. 3) end proc

proc (i, j) options operator, arrow; sum('cat(A, _, i, j, k)', 'k' = 1 .. 3) end proc

(1)

q := proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

(2)

r := sum('q(i)', 'i' = 1 .. 3)

A_331+A_332+A_333+A_321+A_322+A_323+A_311+A_312+A_313+A_231+A_232+A_233+A_221+A_222+A_223+A_211+A_212+A_213+A_133+A_123+A_131+A_132+A_121+A_122+A_111+A_112+A_113

(3)

If I modify p (I make it twice its initial value), then this does not affect the value of q and r

p := proc (i, j) options operator, arrow; 2*(sum('cat(A, _, i, j, k)', 'k' = 1 .. 3)) end proc

proc (i, j) options operator, arrow; 2*(sum('cat(A, _, i, j, k)', 'k' = 1 .. 3)) end proc

(4)

q := proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

(5)

r := sum('q(i)', 'i' = 1 .. 3)

A_331+A_332+A_333+A_321+A_322+A_323+A_311+A_312+A_313+A_231+A_232+A_233+A_221+A_222+A_223+A_211+A_212+A_213+A_133+A_123+A_131+A_132+A_121+A_122+A_111+A_112+A_113

(6)

Why?
Even if I  unassign p, q and r, this does not work, either.

unassign('p', 'q', 'r')

p := proc (i, j) options operator, arrow; 2*(sum('cat(A, _, i, j, k)', 'k' = 1 .. 3)) end proc

proc (i, j) options operator, arrow; 2*(sum('cat(A, _, i, j, k)', 'k' = 1 .. 3)) end proc

(7)

q := proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

(8)

r := sum('q(i)', 'i' = 1 .. 3)

A_331+A_332+A_333+A_321+A_322+A_323+A_311+A_312+A_313+A_231+A_232+A_233+A_221+A_222+A_223+A_211+A_212+A_213+A_133+A_123+A_131+A_132+A_121+A_122+A_111+A_112+A_113

(9)

Only if I restart, then I can modify p and change the rest of values

restart

p := proc (i, j) options operator, arrow; 2*(sum('cat(A, _, i, j, k)', 'k' = 1 .. 3)) end proc

proc (i, j) options operator, arrow; 2*(sum('cat(A, _, i, j, k)', 'k' = 1 .. 3)) end proc

(10)

q := proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

proc (i) options operator, arrow; sum('p(i, j)', 'j' = 1 .. 3) end proc

(11)

r := sum('q(i)', 'i' = 1 .. 3)

2*A_332+2*A_333+2*A_323+2*A_331+2*A_313+2*A_321+2*A_322+2*A_311+2*A_312+2*A_231+2*A_232+2*A_233+2*A_221+2*A_222+2*A_223+2*A_212+2*A_213+2*A_211+2*A_131+2*A_132+2*A_133+2*A_121+2*A_122+2*A_123+2*A_111+2*A_112+2*A_113

(12)

``

``


 

Download problem_with_sums.mw

Hello,

I'm struggling with following simple problem which I however cannot seem to implement easily in Maple:

  • I have 2 different periodic functions: f1 and f2, each time in  variables x and t.
  • On the second function f2 a duty cycle with period T and fraction q should need to be applied so that:
    • during the DUTY (=ON or 1) part of this period, so from 0 -> q*T, f2__DC=f2
    • during the remainder (=OFF or 0) part of this period, so from q*T->T, f2__DC=0
    • each subsequent DUTY part starts at the same point where it ended at the previous cycle, so as if f2 was 'froozen' during the OFF part (see code for more details, but basically this means that the t parameter needs to be constantly translated depending on which duty cycle we are in).
  • In the end I want to calculate f1*f2 in a simple way using ranges for both variables x and t so that e.g. plotting can easily be done.

I've tried implicit functions and procedures but keep getting stuck whenever I introduce a second variable.  Somehow, Maple does not seem to work straightforward with non-univariate stuff.  Such an examples can also not be found in the programming guide so I'm hoping that one of you knows how to tackle this.

Any help will be much appreciated!
 

restart;
with(plots):

f1 := (x, t) -> A * (1 + B * sin(a*x-b*t));

proc (x, t) options operator, arrow; A*(1+B*sin(a*x-b*t)) end proc

(1)

f2 := (x, t) -> C * (1 + E * sin(c*x-d*t));

proc (x, t) options operator, arrow; C*(1+E*sin(c*x-d*t)) end proc

(2)

A:=1: B:=0.5: a:=100: b:=1:
C:=1: E:=0.5: c:=10: d:=10:

densityplot(f1(x,t) * f2(x,t), x = 0..1, t = 0..10, style=patchnogrid);

 

#Duty cycle (DC) applied to f2
# ON state:      n*T <= t <(n+q)*T  : f2__DC(x,t)=f2(x,t-n*(1-q)*T)
# OFF state: (n+q)*T <= t < (n+1)*T : f2__DC(x,t)=0 (so all other cases)
# (n is a positive integer, zero included, and n=floor(t/T))

T:=1:
q:=0.3; #fraction of T where DC is 1=ON

#How to apply the above DC to f2(x,t) so that f2__DC is obtained and following command works:
densityplot(f1(x,t) * f2__DC(x,t), x = 0..1, t = 0..10, style=patchnogrid);

 


 

Download dutycycle_.mw

windows 11 maple 2020 I can load other packages but cannot load the student packages

I need to use convert of complex exponentials to trig, but only to convert exp(I*x) to cos/sin using Euler formula.

The problem is that, since this is done in code without looking at what is inside the exp(), Maple will also convert non complex exponentials as exp(x) to hyperpolic trig which I do not want.  An example will make this clear

For an example, given exp(3*I*x - x)  and applying convert/trig to this it gives 

             (cosh(x) - sinh(x))*(cos(3*x) + sin(3*x)*I)                       --(1)

But I only want to conver the exp(3*I*x) part of the of the above to obtain

          exp(-x) *  (cos(3*x) + sin(3*x)*I)                          ---(2)

I can break  exp(3*I*x - x) first using expand command and obtain  exp(-x) exp(3*I*x) and then parse this and filter out the complex exponentials (may be using select with has I) and then use convert on those terms only leaving the non-complex exponentials alone. But this gets messy for more complex exponentials.

Is there an easy way to tell Maple  to convert expression of the form exp(I*f(x) + g(x)) to trig but only to sin/cos, hence leaving the exp( g(x) ) as a factor? I looked at help but see nothing there so far.

Maple 2021.2

Hi

My integrals are convolutions.and I know I can evaluate this using numerical integration, but I am seeking a numerical solution of this problem using FFT. I have many many integrals of this type to evaluate and I need FFT for speed reasons.

fft.mw

This might inspire you.

https://www.mathworks.com/matlabcentral/answers/228107-how-to-evaluate-a-convolution-integral-by-fast-fourier-transform

I do not understand why what I do in my first example does not work in the problem of integral. Can anyone help me? Thank you very much!

 

restart

assume(x > 0)

solve(x^2+3*x-4 = 0, x)

Warning, solve may be ignoring assumptions on the input variables.

 

1, -4

(1)

solve(x^2+3*x-4 = 0, x, UseAssumptions)

1

(2)
   

Download First_example_Maple.mw

 
 
 

f := proc (x) options operator, arrow; sin(100/(x+13)) end proc

proc (x) options operator, arrow; sin(100/(x+13)) end proc

(2.1.1)

g := proc (x) options operator, arrow; 10/(10*x+3) end proc

proc (x) options operator, arrow; 10/(10*x+3) end proc

(2.1.2)
   
 

A := fsolve(f(x) = g(x), x = 1.1)

1.049742001

(2.2.1)

B := fsolve(f(x) = g(x), x = 1.7)

1.676209051

(2.2.2)

C := fsolve(f(x) = g(x), x = 20)

19.35519742

(2.2.3)

 

 

assume(E > C)

solve(int(f(x)-g(x), x = C .. E) = 3, E, UseAssumptions)

Error, (in depends) too many levels of recursion

 

fsolve(int(f(x)-g(x), x = C .. E) = 3, E)

12.00027508

(2.3.1)

fsolve(int(f(x)-g(x), x = C .. E) = 3, E = 30)

28.05987548

(2.3.2)

La valeur de E cherchée est donc d'environ 28,06 unités.

Download Problem_of_integral.mw

This worksheet has an error when executing EulerLagrange.

How can this error be avoided?

Spring_Pendulum.mw

2 3 4 5 6 7 8 Last Page 4 of 52