Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Consider the sequence of numbers 1, 2, 3, 4, ...

Can we plot these points on the real line?

That is, just a line with dots on the numbers 1, 2, 3, 4, ...

Hi Everyone,

I want to do some fourier analysis on a numeric ODE solution but first I wanted to understand all the commands and make sure it worked with a simple example. I created a Array of data which I attempted to take the DFT of but I got an error and I cannot seem to figure out why, I looked through the help pages and it looks like inputs use an Array of data but for some reason mine wont work. 

Worksheet attached, any help greatly appreciated. 

DFT_Test.mw

Dears

Can you give me advice on how to improve the calculation time for Binomial-Beta mcmc Metropolis-Hastings algorithm?

The calculation time for 50 000 samples for my laptop (Dell XPS 9710) takes approx 22 sec.
At the same time, in MathCAD Prime 8.0, the same amount of samples is calculated (using the same procedure) in approx 0.3 s.

======

======

I will be appreciated any help

wzelik

 

HHow do i correct "error, illegal use of an object as a name"

Given a planar graph G 

i) How to find the degrees of the regions of G

ii) The edges in each region as sets

iii) edges in the intersection of regions

dchange gives the error when I try to convert pde into ode. Why?

restarts

with(PDEtools)

pde1 := diff(u(x, t), t)-(diff(u(x, t), `$`(x, 2), t))+3*u(x, t)^2*(diff(u(x, t), x))-2*(diff(u(x, t), x))*(diff(u(x, t), `$`(x, 2)))-u(x, t)*(diff(u(x, t), `$`(x, 3))) = 0

diff(u(x, t), t)-(diff(diff(diff(u(x, t), t), x), x))+3*u(x, t)^2*(diff(u(x, t), x))-2*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x))-u(x, t)*(diff(diff(diff(u(x, t), x), x), x)) = 0

(1)

trans1 := {seq(var[i] = tau[i], i = 2), FN = Y(zz), var[1] = (zz-(sum(lambda[i]*tau[i], i = 2)))/lambda[1]}

{FN = Y(zz), var[1] = (-lambda[2]*tau[2]+zz)/lambda[1], var[2] = tau[2]}

(2)

ode1 := dchange(trans1, pde, [Y(zz), zz, seq(tau[i], i = 2)])

Error, (in dchange/info) the number of new and old independent variables must be the same. Found {zz, tau[2]} as new, while {FN, var[1], var[2]} as old

 

op(lhs(pde1))

diff(u(x, t), t), -(diff(diff(diff(u(x, t), t), x), x)), 3*u(x, t)^2*(diff(u(x, t), x)), -2*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x)), -u(x, t)*(diff(diff(diff(u(x, t), x), x), x))

(3)

 

Download P_O.mw

Hi Everyone,

surely my question has a simple answer, however, I am a bit stumped. I need to calculate field equations for which I need to take the covariant derivative of a tensor density. This yields additional "Christoffel-terms" in the usual manner.

For mathematical details see e.g. (https://math.stackexchange.com/questions/2267059/covariant-derivative-of-tensor-densities)

(I hope it's ok to link resources from another forum)

My problem is that I can't seem to find a command to define a tensor density in the Differential Geometry package. I can only obtain Metric densities through the "MetricDensity" command. However, this command does not create a tensor density in the usual manner.

One workaround might be to substitute the Metric Density from the command mentioned above into the covariant derivative after expanding in terms of the Christoffel-symbols. 

Any input would be appreciated.

I think I mentioned this before long time ago and never got any satisfactory answer. So I thought I will try again.

I never been able to figure why/how dsolve decides when to integrate the intermediate result vs. keeping the integral inert, even though it can integrate it.

It must use some rule internal to decide this, and this is what I am trying to find out.

Here is a very simple separable ode. So this is just really an integration problem.

restart;
ode:=diff(y(x),x)=(b*y(x)+sqrt(y(x)^2+b^2-1) )/(b^2-1);
dsolve(ode)

The first thing that comes to mind, is that Maple could not integrate it, that is why it gave inert integral. but it can integrate it but the result is a little long

int((b^2 - 1)/(b*y + sqrt(y^2 + b^2 - 1)),y)

So it could have generated the above implicit solution instead. Now notice what happens when I make very small change the ode.

restart;
ode:=diff(y(x),x)=(y(x)+sqrt(y(x)^2+b^2-1) )/(b^2-1);
dsolve(ode)

In the above I changed b*y to just y and guess what, now maple will integrate it and give an implicit solution instead of an inert integral

In both cases, Maple is able to do the integration. But in first case, it returned an inert integral and in the second it did not.

my question is why?  Does it have a rule where if the size of the integral is larger than some limit, it does not solve it? Did it say,

     "I think this result is too complicated to the user, so I will keep the integral inert instead"

If so, what are the rules it uses to decide when to do the integration and when to keep it inert? Is it based on leafcount? number of terms? something else?

infolevel does not give a hint on this, as all what it says is that it is separable.

Any one has an ideas on this?

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?

First 139 140 141 142 143 144 145 Last Page 141 of 2097