Maple 2020 Questions and Posts

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

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

Hi

I am trying to get a family of curves on one graph. Each curve a different colour and labeled

P=2, Q=0 , P=2,Q=1 , etc

mmcdara 's proposal for inspiration?

https://www.mapleprimes.com/questions/233088-How-Do-I-Plot-A-Function-Of-Two-Variables

Family_of_curves_plot.mw

Hello there, 

When I tried to write an expression with the '1d' subscript, I found that it was automatically translated as '1.'. The following worksheet shows an example. Is there any chance to preserve the expression as I intended to see?

restart;

eq3_130:= Psi[fd] = L[ffd]*i[fd]+L[f1d]*i[1d]-L[ad]*i[d];

Psi[fd] = -L[ad]*i[d]+L[f1d]*i[1.]+L[ffd]*i[fd]

(1)

 

Download Q20220121.mw

I have just come across this curious but really boring problem.
In the code snippet below, expr1 and expr2 are identical.

restart:
data := [a=1, b=2]:
convert(
  piecewise(And(x(t) > a, x(t) < b), 1, 0),
  Heaviside
):
expr1 := eval(eval(%, data),  x(t)=z):
plot(expr1, z=0..3);


convert(
  piecewise(And(z > a, z< b), 1, 0),
  Heaviside
):
expr2 := eval(%, data),:
plot(expr2, z=0..3);


But if I change the parameterization of the problem, expr2 is still correct but expr1 is not

restart:
data := [d=1.5, a=0.5]:
convert(
  piecewise(And(x(t) > d-a, x(t) < d+a), 1, 0),
  Heaviside
):
expr1 := eval(eval(%, data),  x(t)=z):
plot(expr1, z=0..3);


convert(
  piecewise(And(z > d-a, z< d+a), 1, 0),
  Heaviside
):
expr2 := eval(%, data),:
plot(expr2, z=0..3);

Where does this come from?

PS: I'm sorry not to be able loading the mw file

Hello there, 

Would you allow me to ask these two questions?

1) is there any way to collect the expression 'eq14_2' w.r.t. DeltaP? The question is labeled as 'Q1' in the worksheet. 

2) Why does the 'DeltaP' term survive at the RHS of the expression 'eq14_2_3'? In other words, is it possible to cancel out the same term, 'DeltaP', in numerator and denominator?

restart;

eq14_1_3 := w[NET] = Delta*T[Sfg];

w[NET] = Delta*T[Sfg]

(1)

eq14_2 := w[NET] = -((v[2] + v[3])/2)((-DeltaP + P) - P) - ((v[1] + v[4])/2)((P - P) + DeltaP);

w[NET] = -(1/2)*v[2](-DeltaP)-(1/2)*v[3](-DeltaP)-(1/2)*v[1](DeltaP)-(1/2)*v[4](DeltaP)

(2)

simplify(eq14_2);

w[NET] = -(1/2)*v[2](-DeltaP)-(1/2)*v[3](-DeltaP)-(1/2)*v[1](DeltaP)-(1/2)*v[4](DeltaP)

(3)

collect(expand(eq14_2), DeltaP, distributed); # Q1

w[NET] = -(1/2)*v[2](-DeltaP)-(1/2)*v[3](-DeltaP)-(1/2)*v[1](DeltaP)-(1/2)*v[4](DeltaP)

(4)

Desired1 := w[NET] = DeltaP * (-v[2]*(-1)/2 - v[3]*(-1)/2 - v[1]*(1)/2 - v[4]*(1)/2);

w[NET] = DeltaP*((1/2)*v[2]+(1/2)*v[3]-(1/2)*v[1]-(1/2)*v[4])

(5)

eq14_2_2 := rhs(eq14_1_3) = rhs(eq14_2);

Delta*T[Sfg] = -(1/2)*v[2](-DeltaP)-(1/2)*v[3](-DeltaP)-(1/2)*v[1](DeltaP)-(1/2)*v[4](DeltaP)

(6)

eq14_2_3 := eq14_2_2 / DeltaP; # Q2

Delta*T[Sfg]/DeltaP = (-(1/2)*v[2](-DeltaP)-(1/2)*v[3](-DeltaP)-(1/2)*v[1](DeltaP)-(1/2)*v[4](DeltaP))/DeltaP

(7)

Desired2 := w[NET]/DeltaP =  (-v[2]*(-1)/2 - v[3]*(-1)/2 - v[1]*(1)/2 - v[4]*(1)/2);

w[NET]/DeltaP = (1/2)*v[2]+(1/2)*v[3]-(1/2)*v[1]-(1/2)*v[4]

(8)

 

Download Q20220110.mw

Thank you everyone!

I am trying to solve an ODE with nonlinear boundary conditions, it is a BVP. And the maple let me to specify an approximate initial solution. I just don't know how to define the initial solution. What format is the initial solution? I have tried the Help Document told me to, but I still can't figure it out. Please help me, thank you!

First 6 7 8 9 10 11 12 Last Page 8 of 56