Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Has someone tried to connect Grasshopper with Maple yet?

Grasshopper is a visual programming environment on Rhino.

https://en.wikipedia.org/wiki/Grasshopper_3D

Hello;

I am facing "Error, too many levels of recursion" in loops. kindly guide me. Thanks

 

1D1P.mw


 

restart; printlevel := 3

restart; with(LinearAlgebra); with(linalg); with(CodeGeneration); with(plots); Digits := 30; `ε` := 0.1e-1; k := .5; m := 1; c := 1; q := 1

L[time] := 1:

.200000000000000000000000000000

 

.200000000000000000000000000000

 

.200000000000000000000000000000

(1)

``

ICff := 1.0*exp(-p^2/(2.0))*(1.0+epsilon*cos(1.0*k*x))/sqrt(2.0*Pi):

for i from 0 while i <= N[x] do for j from 0 while j <= N[p] do f[0, i, j] := eval(ICff, [x = i*`&Delta;x`, p = j*`&Delta;p`]) end do end do:

for n from 0 while n <= T do for j from 0 while j <= N[p] do f[n, 0, j] := 0; f[n, N[x], j] := 0 end do end do:

for n from 0 while n <= T do for i from 0 while i <= N[x] do f[n, i, 0] := 0; f[n, i, N[p]] := 0 end do end do:

``

for n1 from 0 while n1 <= T-1 do for i1 while i1 <= N[x] do for j1 while j1 <= N[p] do f[n1+1, i1, j1] := f[n1, i1, j1]-`&Delta;t`*j1*`&Delta;p`*(f[n1+1, i1+1, j1]-f[n1+1, i1-1, j1]+f[n1, i1+1, j1]-f[n1, i1-1, j1])/((4*`&Delta;x`)*(1.0)) end do end do end do

Error, too many levels of recursion

 


 

Dear esteem Colleagues,

Please how do I modify the following two files (though similar) to get consistent errors? I am not sure where I made the mistake.

Any modifications would be appreciated.

Thank you all for your time and mentorship. Best regard

Biratu_Mapleprimes.mw

DDE_2_Mapleprime.mw

I would like to emphasize a particular region of my plot by shading the whole strip between x=0 and x=1. I learned of the command shadebetween, but the functions it takes as arguments for the boundaries of the region to shade must be functions of x.

Does someone know how to shade between two vertical lines?

I am a new user to Maple, but have used PTC's Mathcad and Prime.

I have several matrices that I need to combine both vertically and horizontally.  The command augment will combine the matrices horizontally.  I was unable to find a command to combine the matrices vertically.  I tried the stack command (Prime command).  The Maple stack command appears to have a different functionality.  Could you suggest which command would do the job?  The matrices are large and I would like to limit the number of rows and columns shown in the document.

The next step will be sorting the data. I am researching this at this time.

Thank you for the support,

David Tietje

Alternating serie

 

sum((-1)^(n+1)/(2*n-1), n = 1 .. infinity)

(1/4)*Pi

(1)

 

sum((-1)^(n + 1)/(2*n - 1), n = 1 .. infinity):

sum((-1)^(n+1)/(2*n-1), n = 1 .. 4)

76/105

(2)

expand(sum((-1)^(n + 1)/(2*n - 1), n = 1 .. 4),symbolic);

76/105

(3)

?expand

series(sum((-1)^(n + 1)/(2*n - 1), n = 1 .. infinity),n=0,5);

series((1/4)*Pi,n)

(4)

 

Info series

   

How to get for n= 4  "for (&sum;)(((-1)^(n+1))/(2 n-1))  =   symbolic term 1+ symbolic term 2+... "

 

 

Download onderzoek_reeks_-hoe_krijg_ik_een_partieke_symbolische_som.mw

Input:

 a := x^2;
 whattype(x);
 b := x[1]^2;
 whattype(x[1]);
 CodeGeneration[C](a);
 CodeGeneration[C](b);

Output:

Do you know why cg0 =/= x[0]*x[0]?

Hello people in MaplePrimes,

I can't understand a code with PLOT3D using GRID in it.
I hope you will give me explanation about it.

restart;
k:=[[1,2,10],[1,1,8],[0,1,5],[0,0,6]];
PLOT3D(GRID(1..2,1..3,k),
       AXESLABELS(x,y,z));

I cannot understand the correspondence between points in the graph and lists in the code such as [1,2,10], [1,1,8].

 As two ranges in GRID augments in the code are 1..2 and 1..3, x takes value from 1 to 2, and
y from 1 to 3 in the picture.
And, as k is k:=[[1,2,10],[1,1,8],[0,1,5],[0,0,6]], which means this list of lists are 4 X 3, so in the picture
as for x the interval of 1 to 2 is divided to three sections with the points of value of 0, 1/3, 2/3 and 3/3, which total number is 4.
And, as for y the interval of 1 to 3 is devided to two sections with the points of value of 1, 2 and 3, which total number is 3.

And, I cannot understand why from the grid of [1,1,8] in the code, which I think is the coodinate of (1, 1) on x-y plane, does not mean that the value of z on that point on the graph is not 8, but 1.

graph.mw

restart:

sys:={-diff(v(x,t),t)+0.5*p*diff(u(x,t),x,x)+q*u(x,t)*(u(x,t)^2+v(x,t)^2)=0,diff(u(x,t),t)+0.5*p*diff(v(x,t),x,x)+q*v(x,t)*(u(x,t)^2+v(x,t)^2)=0};
        /                      /  2         \
        |/ d         \         | d          |
sys := < |--- u(x, t)| + 0.5 p |---- v(x, t)|
        |\ dt        /         |   2        |
        \                      \ dx         /

               /       2          2\       / d         \
   + q v(x, t) \u(x, t)  + v(x, t) / = 0, -|--- v(x, t)|
                                           \ dt        /

           /  2         \                                      \ 
           | d          |             /       2          2\    | 
   + 0.5 p |---- u(x, t)| + q u(x, t) \u(x, t)  + v(x, t) / = 0 >
           |   2        |                                      | 
           \ dx         /                                      / 
eq1 := diff(u(x,t),t) = u__t(x,t):
eq2 := diff(v(x,t),t) = v__t(x,t):

sys_tmp := subs(eq1, eq2, sys):

sys_new := sys_tmp union {eq1, eq2}:

Boundary conditions:
bc :=
    u(0,t) = 2,
    v(0,t) = 0;
                 bc := u(0, t) = 2, v(0, t) = 0
Initial conditions:
ic :=
    u(x,0) = tanh(2*Pi),
    v(x,0) = tanh(2*Pi),
    u__t(x,0) = 0,
    v__t(x,0) = 0;
 
ic := u(x, 0) = tanh(2 Pi), v(x, 0) = tanh(2 Pi), u__t(x, 0) = 0, 

  v__t(x, 0) = 0
Solve the system:
pdsol := pdsolve(subs(p=1, q=0.5, sys_new), {ic, bc}, numeric);

I want to change my variables. The coding below shows the influence of the Nb and Nt on the local Nusselt number (-theta') against the convection Bi.

But now I want it to be  the influence of the Bi on the local Nusselt number (-theta') against the Nb and Nt.

Can anyone help me?

NULL

with(plots)

DE1 := diff(f(eta), `$`(eta, 3))+f(eta)*(diff(f(eta), `$`(eta, 2)))-(diff(f(eta), eta))^2 = 0

diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))-(diff(f(eta), eta))^2 = 0

(1)

DE2 := diff(theta(eta), `$`(eta, 2))+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*(diff(theta(eta), eta))^2 = 0

diff(diff(theta(eta), eta), eta)+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*(diff(theta(eta), eta))^2 = 0

(2)

DE3 := diff(phi(eta), `$`(eta, 2))+Le*(diff(phi(eta), eta))+Nt*(diff(theta(eta), `$`(eta, 2)))/Nb

diff(diff(phi(eta), eta), eta)+Le*(diff(phi(eta), eta))+Nt*(diff(diff(theta(eta), eta), eta))/Nb

(3)

BC1 := f(0) = 0, (D(f))(0) = 1, (D(f))(10) = 0

f(0) = 0, (D(f))(0) = 1, (D(f))(10) = 0

(4)

BC2 := theta(10) = 0, (D(theta))(0) = -Bi*(1-theta(0))

theta(10) = 0, (D(theta))(0) = -Bi*(1-theta(0))

(5)

BC3 := phi(0) = 1, phi(10) = 0

phi(0) = 1, phi(10) = 0

(6)

``

  getRes:= proc(a, x);
                local sol;
                if   type(x, numeric)
                then sol:= dsolve
                           ( eval
                             ( {BC1, BC2, BC3, DE1, DE2, DE3},
                               [Nt = a, Nb = a, Pr = 2, Le = 5, Bi = x]
                             ),
                             numeric,
                             output = listprocedure,
                             abserr = 0.0001,
                             maxmesh = 1024,
                             initmesh = 512
                           );
                else return 'procname(a,x)';
                fi;
                return -eval(diff(theta(eta), eta), sol)(0)
           end proc:

  cl:=[red, green, blue, yellow, black]:
  L:=[0.2, 0.4, 0.6,0.8,1.0]:
  display
  ( [ seq
      ( plot
        ( getRes( L[k], x),
          x=0..5,color = colorList[k], legend = ["Nb=Nt" = L[k]], legendstyle = [location = top],
          color=cl[k]
        ),
        k=1..5
      )
    ]
  )
               

 

 

 

Download odeProb2.mw

Contour integration notation

" (&int;)[+infinity]^(+infinity)((-x)^(z))/((e)^(x)-1). (&DifferentialD;x)/(x)"

 

The limits of integration are intented to indicate a path of integration which begins at + ∞, moves to th e left down the positive real axis, circles the orign once in positive ( counterclockwise) direction, and returns up to the positive real axis to  +∞

-How does this contour look like  in a  graph ?
- the "(&DifferentialD;x)/(x)" notation  ?
- calculating this complexe contour integral?

Seems that the concept of the contour integration is similar wit a line integral in real calculus ?

Some more information needed about singularities ( first en second order ..more?)

Nieuwe pagina 1 (hhofstede.nl)

NULL

Download contourintegraal_vraag1.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

A user would like to know if it is possible to specify a data set say, x:=[1,2,3,4,5,6] and then extract a random sample from that data set, i.e. xsample:=[3,2,4] for a bootstrapping-type calculation.

We suggested they use something like the following:

restart; with(Statistics); my_data := [1, 2, 4, 5.5, 5.5, 6]; X := RandomVariable(EmpiricalDistribution(my_data)); s := Sample(X, 10); Bootstrap(Mean, X, samplesize = 4, replications = 10000)

HFloat(3.9984625)

(1)

NULL

Download array-random-sample.mw

Hello, 

I would like to write to a file the output of the command CodeGeneration[Matlab]. I couldn't find a way to write the output. 

What I am trying to do is to generate complex symbolic equations and expressions and write them as either a function or variables in matlab. 

As an example: 

exp := [sin(theta(1)), cos(theta(1))]; 

func := unapply(exp,[theta]); 

CodeGeneration:-Matlab(func)

If i can write the output of the above command in a matlab file, it will generate a matlab function file. 

I was using the command 'writeto' but this one basically outputs every line a command written to a file instead of the terminal, which is not what I want (it will output even the warnings, I know I can silent them!). 

can you please help.. thanks. 

Hello guys,

I want to plot two functions such as x(t) and y(t) in a unique diagram as a function of each other. In a routine way, one needs to solve one of these functions as t and then input its results in others. for example, solving x(t) to find t and then input this t(x) into y(t) to have y(x). but here problem is that I cannot solve x(t) to find t and so this routine solution is not accelssible.

x(t):=1 + (3*n*(v - 1)^2*A*(t^v)^2*(1 + alpha*(v - 1)^2*A^2*(t^v)^2*ln(m^2*t^2/((v - 1)^2*A^2*(t^v)^2))/(3*n^2*m^2*t^2) + A^2*beta*(v - 1)^2*(t^v)^2/(3*n^2*m^2*t^2))*((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))*(1 + ((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))))/(2*v^2*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (3*n^2*(v - 1)^2*A^2*(t^v)^2*(1 + alpha*(v - 1)^2*A^2*(t^v)^2*ln(m^2*t^2/((v - 1)^2*A^2*(t^v)^2))/(3*n^2*m^2*t^2) + A^2*beta*(v - 1)^2*(t^v)^2/(3*n^2*m^2*t^2))*(((4*A^2*alpha*t^v*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + 4*A^2*alpha*t^v*(v - 1)^2*(2 - 2*v)/t + 6*t^(-v + 2)*(-v + 2)*m^2*n^2/t + 4*t^v*v*(beta - alpha/2)*A^2*(v - 1)^2/t)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) + (4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*n^2*(v - 1)^2*A^2*t^(2*v)/(sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2)*v*t) - 3*n*A*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)^2)))/(2*v^2):

y(t):=1 + ((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (((4*A^2*alpha*t^v*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + 4*A^2*alpha*t^v*(v - 1)^2*(2 - 2*v)/t + 6*t^(-v + 2)*(-v + 2)*m^2*n^2/t + 4*t^v*v*(beta - alpha/2)*A^2*(v - 1)^2/t)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) + (4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*n^2*(v - 1)^2*A^2*t^(2*v)/(sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2)*v*t) - 3*n*A*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)^2))*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)/((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)):

there are x(t) and y(t). I want to plot y as x, not t. so please help me.

with best

First 221 222 223 224 225 226 227 Last Page 223 of 2097