Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello everyone!

How do I get some information about my computer (eg Windows edition,System processor, Computer name, .....) with the Maple command?

Thanks for your help!

I can generate Bode Plots from a transfer function but I just need to know what the gain is at a specific frequency.  Is there a simple way to do that without having examine the plots?

Thank you,

David

Hello all,

I am fairly new to Maple and would like to programatically simplify the output form using Maple's pade function on an arbitrary function: Y := 1/(R__s + 1/(s*C__dl + 1/(R__ct + 1/(sqrt(s)/sigma + 1/R__w))))
I found that only Maple's pade function was able to convert my function into a rational expression which is quite interesting.

Now I would like to replicate using maple what was manually done in steps 2 - 4 of the attached solution pdf (which was done by hand).

I was only able to do step 1 (as shown in the attached maple worksheet) after which I got stuck.

kindly assist

restart

with(numapprox)

[chebdeg, chebmult, chebpade, chebsort, chebyshev, confracform, hermite_pade, hornerform, infnorm, laurent, minimax, pade, remez]

(1)

s = I*omega

s = I*omega

(2)

Y := 1/(R__s+1/(s*C__dl+1/(R__ct+1/(sqrt(s)/sigma+1/R__w))))

1/(R__s+1/(s*C__dl+1/(R__ct+1/(s^(1/2)/sigma+1/R__w))))

(3)

padey := pade(Y, x = sqrt(s), [1, 1])

(C__dl*s^(3/2)*R__ct*R__w+C__dl*R__ct*s*sigma+C__dl*R__w*s*sigma+s^(1/2)*R__w+sigma)/(C__dl*s^(3/2)*R__ct*R__s*R__w+C__dl*R__ct*R__s*s*sigma+C__dl*R__s*R__w*s*sigma+s^(1/2)*R__ct*R__w+s^(1/2)*R__s*R__w+R__ct*sigma+R__s*sigma+sigma*R__w)

(4)

collect((C__dl*s^(3/2)*R__ct*R__w+C__dl*R__ct*s*sigma+C__dl*R__w*s*sigma+s^(1/2)*R__w+sigma)/(C__dl*s^(3/2)*R__ct*R__s*R__w+C__dl*R__ct*R__s*s*sigma+C__dl*R__s*R__w*s*sigma+s^(1/2)*R__ct*R__w+s^(1/2)*R__s*R__w+R__ct*sigma+R__s*sigma+sigma*R__w), s)

(C__dl*s^(3/2)*R__ct*R__w+(C__dl*R__ct*sigma+C__dl*R__w*sigma)*s+s^(1/2)*R__w+sigma)/(C__dl*s^(3/2)*R__ct*R__s*R__w+(C__dl*R__ct*R__s*sigma+C__dl*R__s*R__w*sigma)*s+(R__ct*R__w+R__s*R__w)*s^(1/2)+R__ct*sigma+R__s*sigma+sigma*R__w)

(5)

padey2 := collect((C__dl*s^(3/2)*R__ct*R__w+C__dl*R__ct*s*sigma+C__dl*R__w*s*sigma+s^(1/2)*R__w+sigma)/(C__dl*s^(3/2)*R__ct*R__s*R__w+C__dl*R__ct*R__s*s*sigma+C__dl*R__s*R__w*s*sigma+s^(1/2)*R__ct*R__w+s^(1/2)*R__s*R__w+R__ct*sigma+R__s*sigma+sigma*R__w), sigma)

((C__dl*R__ct*s+C__dl*R__w*s+1)*sigma+C__dl*s^(3/2)*R__ct*R__w+s^(1/2)*R__w)/((C__dl*R__ct*R__s*s+C__dl*R__s*R__w*s+R__ct+R__s+R__w)*sigma+C__dl*s^(3/2)*R__ct*R__s*R__w+s^(1/2)*R__ct*R__w+s^(1/2)*R__s*R__w)

(6)

Download maple_attempt.mw

solution.pdf

Why Maple returns empty solution (see eq. (5))? Also, is it possible that Maple not only gives us the explit solution but also the solution steps?

restart

with(PDEtools, TWSolutions, declare)

[TWSolutions, declare]

(1)

with(DEtools, diff_table)

[diff_table]

(2)

U := diff_table(u(x, t))

table( [(  ) = u(x, t) ] )

(3)

sys := {U[]*U[x]+U[t]-pU[x, x]+qU[x, x, x] = 0}

{u(x, t)*(diff(u(x, t), x))+diff(u(x, t), t)-pU[x, x]+qU[x, x, x] = 0}

(4)

TWS_sol := TWSolutions(sys)

(5)

map(pdetest, [TWS_sol], sys)

[]

(6)

``

Download twsol.mw

Dear maple user i am facing difficulty to plot the graph   for different values  of parameter M=2,4  and fixing t=j=0 to 2 and   y=i=0 to 4 on x axis and U on y axis. I am unable to plot 2D . I am enclosing the codes and sample graphs. 

restart; 
# Parameter values:
 Pr:=0.71:E:=1:A:=0:Sc:=0.02: K:=1:

a := 0: b := 1: N := 9:
h := (b-a)/(N+1): k := (b-a)/(N+1):

 lambda:= 1/h^2:  lambda1:= 1/k^2:
# Initial conditions
for i from 0 to N do 
  U[i, 0] := h*i+1:
end do:


for i from 0 to N do 
  T[i, 0] := h*i+1:
end do:
for i from 0 to N do 
  C[i, 0] := h*i+1:
end do:

# Boundary conditions
for j from 0 to N+1 do 
  U[0, j] := exp(A*j*lambda); 
  U[N+1, j] := 0;
  T[0, j] := j*lambda1; 
  T[N+1, j] := 0;
  C[0, j] := j*lambda1; 
  C[N+1, j] := 0 
end do:


#Discretization Scheme
for i to N do 
  for j from 0 to N do 
    eq1[i, j]:= lambda1*(U[i, j+1]-U[i, j]) = (Gr/2)*(T[i, j+1]+T[i,j])+(Gr/2)*(C[i, j+1]+C[i,j])+(lambda^2/2)*(U[i-1,j+1]-2*U[i,j+1]+U[i+1,j+1]+U[i-1,j]-2*U[i,j]+U[i+1,j])-(M/2)*(U[i,j+1]+U[i,j]) ;
    eq2[i, j]:= lambda1*(T[i, j+1]-T[i, j]) = (1/Pr)*(lambda^2/2)*(T[i,j+1]-2*T[i,j+1]+T[i+1,j+1]+T[i-1,j]-2*T[i,j]+T[i+1,j])+(E*lambda^2)*((U[i+1,j]-U[i,j])^2);
    eq3[i, j]:= lambda1*(C[i, j+1]-C[i, j]) = (1/Sc)*(lambda^2/2)*(C[i,j+1]-2*C[i,j+1]+C[i+1,j+1]+C[i-1,j]-2*C[i,j]+C[i+1,j])+(K/2)*((C[i,j+1]+C[i,j]))  
  end do
end do:


#
# Determine the unknowns in the system
#
  `union`(  seq(seq( indets( eq1[i,j], name), i=1..N), j=0..N),
            seq(seq( indets( eq2[i,j], name), i=1..N), j=0..N),
            seq(seq( indets( eq3[i,j], name), i=1..N), j=0..N)
          );
#
# And how many unknowns
#
   numelems(%);
#
# And the number of equations
#
  numelems(eq1)+numelems(eq2)+numelems(eq3);

#
# So if one supplies values for 'Gr' and 'M', and
# (assuming the equations are consistent), one ought
# to be able to get values for C[1..9, 1..10],
# T[1..9,1..10], and U[1..9,1..10]
#
# As an example below, choos Gr=1.0 and M=2, then the
# following obtains a 'solution` afer a minute or so
#
  fsolve( eval( [ seq(seq(eq1[i,j], i=1..N),j=0..N),
                  seq(seq(eq2[i,j], i=1..N),j=0..N),
                  seq(seq(eq3[i,j], i=1..N),j=0..N)
                ],
                [Gr=1.0, M=2]
 )
        );


 

 

 

Is there more or less simple way to generate magic and semi magic squares in maple by just giving the order and the magic constant?

It appears that using 2D math can generate hidden characters that make code not run. 

It seems like a lot of people think that using 1D math is a no-brainer, as if it had all the advantages and no disadvantages.

I am trying to write code for an object. I was using 2D math, because the automatic formatting of the code (italics, bold) makes it much easier to see and understand the code. Then again, I ran into an issue I face sometimes which is that code that looks absolutely perfect can't be parsed. 

I read that we can convert the code to 1D math and we will see hidden characters messing things up but that doesn't seem to be the case (or at least I can't seem to see the extra character). And in any case, it is just maddening and not a productive thing to have to do.

Is 1D math really the best user experience that is available? Is there really a tradeoff between legibility and useability in Maple 2022?

This ode from textbook, and the solution is given in back of book and I verified it is correct.

odetest gives zero also when asked to verify the solution.

but when asked to verify both the solution and the initial conditions, instead of returning [0,0] as expected, it returns [the_ode,0]

Here is an example
 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart

ode:=diff(y(x), x) = 2*(2*y(x) - x)/(x + y(x));
ic:=y(0) = 2;
booksol:=(x-y(x))^2/( y(x)-2*x)^3 = 1/2;

diff(y(x), x) = 2*(2*y(x)-x)/(x+y(x))

y(0) = 2

(x-y(x))^2/(y(x)-2*x)^3 = 1/2

#this returns zero, so maple agree the book solution is correct
odetest(booksol,ode)

0

#when adding ic, when does it not give [0,0] ?
odetest(booksol,[ode,ic])

[diff(y(x), x)-2*(2*y(x)-x)/(x+y(x)), 0]

 


How shoulld one interpret the above answer?

Download question_on_odetest_nov_14_2022.mw

Consider the following system of differential equations

sys := diff(y(x), x) = z(x)*f1(i), diff(z(x), x) = y(x)*f2(i)

where f1 and f2 are functions that depend on the current iteration. Ultimately, I'd like to index into an array that has the length of the number of iterations, to obtain a value that will be part of the differential equations. It's an array of random numbers, but I'd rather not have to generate them on the fly while dsolve is working.

I've been investigating the use of Events for this, but the documentation is quite atrocious and outdated (and I only know this because, for example, when I try to use certain arguments to dsolve some error messages show that the arguments have changed name)

Please help me to prove that the limit of the following function does not exist:

I've read the documentation on events, and as far as I can tell after an hour or two, I am doing exactly what is in the documentation but not getting the expected result.

Here is a worksheet illustrating the issue: dsolve_events.mw

Basically there is a very simply system of two differential equations and I would simply like to see an event triggered when the dependent variable is above 2. 

This event has no useful interpretation, it was just my attempt at trying to get something to trigger (I have tried multiple things). As far as I can tell from the docs I am using an event specification of form 

[0, c(t,y(x)) < 0]: discrete event with a conditional trigger

ie, [0,2-x<0]

and when that is triggered I set i(x) to something like i(x)+1 (but even something as simple as assigning it to some constant like 7, given that the initial value i(0)=0, would allow me to check when the event is being triggered), where i(x) is defined as a discrete variable (my ultimate goal is to trigger the event on every iteration and have i be the iteration counter. I want to use this iteration counter in the equations)

I run the dsolve command, assign the result to a variable and then call, for example p(3). I would expect to see the event triggered and i(3) not equal to the initial value i(0). But the value of i(x) doesn't change.