Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I know how to define functions and generally how to pass them to another function and usually everything works out... rarely though I run in to problems and my lack of how maple works internally becomes a stumbling block. I usually just hack things together. I'd rather understand what exactly is happening.

 

It seems that apply and unapply have something to do with this.

 

I usually define functions like this, e.g.,

 

f := x->x^2 + 3;

g := (f,x)->cos(f(x));

 

and things like g(f,x) work as expected.

But this doesn't always work.

 

E := proc(f, depth)
    if depth <= 0 then return f; fi:
     E(f(x), depth-1); # Trying to actually compute f(f(x)), say. I know we can just loop.
end proc:


E(x->2*x, 3);

2*x(x)(x)

 

rather than 8x

 

I see that maple is somehow applying the function but in some odd way(it seems to be creating a function from the variable x and then another function from that).

 

Anyways, I don't understand the mechanics of it. In some cases f works other one must add the variablef(x), etc...

 

There seems to be some subtle difference between f and f(x)...  In a programing language like C. f is sort of a function pointer and f(x) is an evaluation of f at x. I guess there is something similar goingn on with maple but i've not been able to figure it out. Any ideas?

I have been able implement this procedure here. 

AreaBetween := overload([proc(fnc::{list}, a::anything, b::anything, col::list) option overload; plottools:-transform(unapply([x, y + fnc[2]], x, y))(plot([fnc[1]] + [-fnc[2]], x = a .. b, col = [col[2], col[3]], gridlines, size = [600, 600], thickness = 3, filled = [color = col[1]])); end proc])

1) How do get to construct a larger canvas? Meaning if I want a xy axis, x = -10..10, y = -10..10 however only x = a..b is suppose to be shaded. Can I do that with my procedure? 

2) Only the lower graph is colored currently. How do I get it to color the upper graph? 

Many thanks in advance. 

Hello;

Maple 2019.2.1 on windows 10

Is there a trick to make inttrans:-fourier(erf(x),x,k) return the Fourier transform of the error function? Now, using Maple 2019.2.1 it returns unevaluated. But direct application of Fourier transform integral does return the correct result. So why inttrans does not work? 
 

inttrans:-fourier(erf(x),x,k)

fourier(erf(x), x, k)

1/sqrt(2*Pi)*int(erf(x)*exp(-I*x*k),x=-infinity..infinity)

-I*2^(1/2)*exp(-(1/4)*k^2)/(Pi^(1/2)*k)

 

 

Download erf.mw

 

 

 

Hi,


I have a set of functions of the form P :=  { a(t), b(t), f(g(t)), u(v(w(t)), A(a(t), b(t)), ... } and I want to obtain the set Q := { a(t), b(t), g(t), w(t) } (that is the set of the innermost functions)
Since more than an hour I'm fighting without success with select and parmatch and I'm desperatly askink for your help.

Thanks in advance
 
PS : the list P only contains functions of t, never of t and of another variables.

Any one help me  to remove the error.

I want to plot the curve for different values of alpha.

here is my codes.

thanks in advance 

 

restart:
with(linalg):with(plots): 
ge[1]:=diff(u[1](x,t),t)=alpha*diff((u[2](x,t)-1)*diff(u[1](x,t),x),x)+(16*x*t-2*t-16*(u[2](x,t)-1))*(u[1](x,t)-1)+10*x*exp(-4*x):
ge[2]:=diff(u[2](x,t),t)=diff(u[2](x,t),x$2)+alpha*diff(u[1](x,t),x)+4*(u[1](x,t)-1)+x^2-2*t-10*t*exp(-4*x): 
bc1[1]:=u[1](x,t)-1: 
bc1[2]:=u[2](x,t)-1: 
bc2[1]:=3*u[1](x,t)+diff(u[1](x,t),x)-3:
bc2[2]:=5*diff(u[2](x,t),x)-evalf(exp(4))*(u[1](x,t)-1):
IC[1]:=u[1](x,0)=1: 
IC[2]:=u[2](x,0)=1: 
NN:=2: 
N:=2:
L:=1:
for i to NN do  
dydxf[i]:=1/2*(-u[2,i](t)-3*u[0,i](t)+4*u[1,i](t))/h: 
dydxb[i]:=1/2*(u[N-1,i](t)+3*u[N+1,i](t)-4*u[N,i](t))/h:
dydx[i]:=1/2/h*(u[m+1,i](t)-u[m-1,i](t)); 
d2ydx2[i]:=1/h^2*(u[m-1,i](t)-2*u[m,i](t)+u[m+1,i](t)):od:
 for i to NN do bc1[i]:=subs(diff(u[1](x,t),x)=dydxf[1],
diff(u[2](x,t),x)=dydxf[2],u[1](x,t) 
=u[0,1](t),u[2](x,t)=u[0,2](t),x=0,bc1[i]):od: 
for i to NN do bc2[i]:=subs(diff(u[1](x,t),x)=dydxb[1],
diff(u[2](x,t),x)=dydxb[2],u[1](x,t) 
=u[N+1,1](t),u[2](x,t)=u[N+1,2](t),x=L,bc2[i]):od:
for i to NN do eq[0,i]:=bc1[i];eq[N+1,i]:=bc2[i]:od: 
for i from 1 to N do eq[i,1]:=diff(u[i,1](t),t)= subs(diff(u[1](x,t),x$2) =
subs(m=i,d2ydx2[1]), 
diff(u[2](x,t),x$2) = subs(m=i,d2ydx2[2]),diff(u[1](x,t),x) =
subs(m=i,dydx[1]),diff(u[2](x,t),x) = subs(m=i,dydx[2]),u[1](x,t)=u[i,1](t), 
u[2](x,t)=u[i,2](t),x=i*h,rhs(ge[1])):od:

for i from 1 to N do eq[i,2]:=diff(u[i,2](t),t)= subs(diff(u[1](x,t),x$2) =
subs(m=i,d2ydx2[1]), 
diff(u[2](x,t),x$2) = subs(m=i,d2ydx2[2]),diff(u[1](x,t),x) =
subs(m=i,dydx[1]),diff(u[2](x,t),x) = subs(m=i,dydx[2]),u[1](x,t)=u[i,1](t),
u[2](x,t)=u[i,2](t),x=i*h,rhs(ge[2])):od: 

for i to NN do u[0,i](t):=(solve(eq[0,i],u[0,i](t))):od:

 for i to NN do u[N+1,i](t):=(solve(eq[N+1,i],u[N+1,i](t))):od:

 h:=L/(N+1): 

for i from 1 to N do eq[i,1]:=eval(eq[i,1]):od: 
 for i from 1 to N do eq[i,2]:=eval(eq[i,2]):od:

eqs:=seq(seq((eq[i,j]),i=1..N),j=1..NN): 
Y:=seq(seq(u[i,j](t),i=1..N),j=1..NN): 

 ICs:=seq(u[i,1](0)=rhs(IC[1]),i=1..N),seq(u[i,2](0)=rhs(IC[2]),i=1..N): 

sol:=dsolve({eqs,ICs},{Y},type=numeric,stiff=true,maxfun=1000000,abserr=1e-6,relerr=1e-5,output=listprocedure):

Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)
for j to NN do for i to N do U[i,j]:=subs(sol,u[i,j](t)):od:od: 

for i to NN do U[0,i]:=subs(u[1,1](t)=U[1,1],u[1,2](t)=U[1,2],
u[2,1](t)=U[2,1],u[2,2](t)=U[2,2],u[0,i](t)):od:
 for i to NN do U[N+1,i]:=eval(subs(u[N,1](t)=U[N,1],u[N,2](t)=U[N,2],
u[N-1,1](t)=U[N-1,1],u[N-1,2](t)=U[N-1,2],u[N+1,i](t))):od:
tf:=1.: 
M:=30: 
T1:=[seq(tf*i/M,i=0..M)]: 
PP:=matrix(N+2,M+1): 
for i from 1 to N+2 do PP[i,1]:=evalf(subs(x=(i-1)*h,rhs(IC[1]))):od: 
for i from 1 to N+2 do for j from 2 to M+1 do
PP[i,j]:=evalf(subs(t=T1[j],U[i-1,1](t))):od:od:
 
G1:=[seq([ seq([(i-1)*h,T1[j],PP[i,j]], i=1..N+2)], j=1..M+1)]: 
t=0.02: 
pars:=[0.1,0.5,1,2,5];
clr:=[black,red,green,gold,blue];  
for m from 1 to 5 do 
G1[m]:=plot([seq(subs(alpha=pars[m],G1[i])],i=0..N+1)],thickness=3,color=clr[j]):od:  

display({seq(G1[i],i=1..5)},title="Figure ",axes=boxed,labels=[x,u]);
restart:
 

Eksamensopgaver_samlet.mw

Hey

Can anyone help me with this file?

I don't know how it happend, but the file somehow got corrupted. Is there anything i can do?

Thanks 

 s0lve  diff(U, x, t) = U by admion decomposition method

if there is a equation subs(...)

how to make a similar symbol like Diff(f(t),t) and diff(f(t),t) use for a new solver procedure use?

Hello Everyone;
I want to make this code complete in proc envirement (Proc command in maple). Kindly help me. Thanks in advance.

There are 10 questions. each question has one negetive point and three positive points. what is the number of students so that there will not be any repeatitive grades so all the students have distinct grades. Thanks in advance

Hello Everyone, 

I am new to Maple and I have designed an algorithm to compute multivariate differential dimension Grobner bases. Now I want to add this Maple as a package but I do not how to do that.

Can someone please help with this.

Thank you so much for your help.

My code can be found at https://github.com/Gsparsh/Grobner-bases

Hi,

I am a newbie and therefore have a rather simple question for the community:

By reading in my measurement data (topographic data) I have generated column vectors:
for i from 1 to k do
    B[i] := Vector(A[1 .. k, i]);
end do:
where k is a predefined rank of the original square matrix. The arithmetic mean was then calculated for each individual column vector:
for i from 1 to k do
    Am[i] := add(B[i][n], n = 1 .. k)/k;
end do:

Now I try to create new column vectors by subtracting the corresponding mean value from each entry of the original vectors, something like that:
for i from 1 to k do
C[i]:=B[i][n]-Am[i],n=1..k

But I just can't get it right. Can anyone help me? Thanks in advance!

Cheers
Christian

 

For example, the column dimension is 6 and I ran the following command,

A := Mod(2,Matrix(3,6,(i,j)->if i<2 and j < 3 then 1  elif i = 2 and j > 2 and j <5 then 1 else 0 end if),float[8])

the result is the following matrix with the last row containing all 0s. 

A := Matrix(3, 6, [[1., 1., 0., 0., 0., 0.], [0., 0., 1., 1., 0., 0.], [0., 0., 0., 0., 0., 0.]])
Actually, I want the last row containing all 1s but I do not know how.
Any help?

 

i want to write a expression without any quotes . for example in this case i want to wrate E*1    E*2 

I if a run the CompleteSquare command 

 

CompleteSquare(x^2 + y^2 - 2*x - y - 2 = 10, x, y)

the output is (y - 1/2)^2 + (x - 1)^2 - 13/4 = 10

Why does it places the y's before the x's? 

First 485 486 487 488 489 490 491 Last Page 487 of 2097