Maple 18 Questions and Posts

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

Dear All

I am trying to use differential operator two times in sucession but I am not getting desired differentiation. Please see content below:


 

with(PDEtools):

DepVars := [u(x, t), v(x, t), phi(x, t), psi(x, t)]; 1; declare(u(x, t), v(x, t), phi(x, t), psi(x, t))

[u(x, t), v(x, t), phi(x, t), psi(x, t)]

 

u(x, t)*`will now be displayed as`*u

 

v(x, t)*`will now be displayed as`*v

 

phi(x, t)*`will now be displayed as`*phi

 

psi(x, t)*`will now be displayed as`*psi

(1)

_local(I):

I := phi(x, t)*(diff(v(x, t), x)+b*(diff(u(x, t), x, x)))+psi(x, t)*(diff(u(x, t), x, x, x)+d*(diff(v(x, t), x, x)))

phi(x, t)*(diff(v(x, t), x)+b*(diff(diff(u(x, t), x), x)))+psi(x, t)*(diff(diff(diff(u(x, t), x), x), x)+d*(diff(diff(v(x, t), x), x)))

(2)

ToJet(I, DepVars)

phi*(b*u[x, x]+v[x])+psi*(d*v[x, x]+u[x, x, x])

(3)

T[1] := proc (f) options operator, arrow; diff(f, u[x]) end proc; 1; T[2] := proc (f) options operator, arrow; diff(f, u[x, x]) end proc; 1; T[3] := proc (f) options operator, arrow; diff(f, u[x, x, x]) end proc; 1; U[1] := proc (f) options operator, arrow; diff(f, v[x]) end proc; 1; U[2] := proc (f) options operator, arrow; diff(f, v[x, x]) end proc

proc (f) options operator, arrow; diff(f, u[x]) end proc

 

proc (f) options operator, arrow; diff(f, u[x, x]) end proc

 

proc (f) options operator, arrow; diff(f, u[x, x, x]) end proc

 

proc (f) options operator, arrow; diff(f, v[x]) end proc

 

proc (f) options operator, arrow; diff(f, v[x, x]) end proc

(4)

d := proc (f) options operator, arrow; diff(f, x)+u[x]*(diff(f, u))+u[x, x]*(diff(f, u[x]))+u[x, x, x]*(diff(f, u[x, x])) end proc

proc (f) options operator, arrow; diff(f, x)+u[x]*(diff(f, u))+u[x, x]*(diff(f, u[x]))+u[x, x, x]*(diff(f, u[x, x])) end proc

(5)

T[2](I)

0

(6)

Why this is giving zero result ?

If I change Ito jet notation then I get result non zero result like:

T[2](phi*(b*u[x, x]+v[x])+psi*(d*v[x, x]+u[x, x, x]))

phi*b

(7)

d(T[2](phi*(b*u[x, x]+v[x])+psi*(d*v[x, x]+u[x, x, x])))

0

(8)

I was expecting this to be "phi[x]*b, "but instead I am getting zero result.``


 

Download operator_for_differentiation.mw

G := 6.6743*10^(-8);

a := 1.9501*10^24;

b := .3306;

c := 2.99792458*10^10;

d := 2.035;

pi := 3.143;

eps := 3.8220*10^35;

g(r) = 1-s(r)/0.06123;

j(r) = e^(-(1/2)*w(r))*(1-2*G*v(r)/(r*c^2))^.5

sys := diff(v(r), r) = 4*pi*r^2*eps/c^2, ics=v(0)=0

diff(u(r), r) = -G*(eps+u(r))*(v(r)+4*Pi*r^3*u(r)/c^2)/(c^2*(r^2-2*G*r*v(r)/c^2)),u(0)=1.3668*10^34

diff(w(r), r) = 1.485232054*10^(-28)*(v(r)+4.450600224*10^(-21)*pi*r^3*u(r))/(r^2-2*G*r*v(r)/c^2), conditions: w(0)=0,iterate it to find w(688240)=-2.05684, it solve must satistfy the both conditions.

diff(r^4*j(r)*(diff(g(r), r)), r)+4*r^3*g(r)*(diff(j(r), r)) = 0, conditions dg(r)/dr =0  at r=0, g(688240) =0.87214

diff(J(r), r) = (8*pi*(1/3))*(eps/c^2+u(r)/c^2)*(g(r)*j(r).(r^4))/(1-2*G*v(r)/(r*c^2)) condition J(0)=0.

I am trying to apply window functions from the SignalProcessing package to arrays. However, some window functions (e.g. Hann) appear to operate on a [0..N-1] index basis, others (e.g. Welch) work on [1..N].

I don't know how to make the latter ones work correctly, since after applying the windowing function the first entry in the array is not zero, as it should be.

Best regards

I have made an algorithm for producing random walks (only possible to walk one step to either direction except downwards(EDIT: It is possible to go downwards, but it has to be when making a turn to the right or left). The walks are determined by the rand function:

R3:=rand(1..3): (1: go straight on; 2: turn right; 3: turn left)
M:=15; N:=1500;

 

Randwalk3:=proc(R3)
  local i,j,r,X,Y,L;
  for j from 1 to M do
    X[0,j]:=0;                                # Initialization
    Y[0,j]:=0;
    X[1,j]:=1;                                # The first step should still be taken to the point (1,0)
    Y[1,j]:=0;
    for i from 2 to N do
      r:=R3();
      if r=1 then X[i,j]:=2*X[i-1,j]-X[i-2,j]; Y[i,j]:=2*Y[i-1,j]-Y[i-2,j];                   # go straight on
      elif r=2 then X[i,j]:=X[i-1,j]+Y[i-1,j]-Y[i-2,j]; Y[i,j]:=Y[i-1,j]-X[i-1,j]+X[i-2,j];    # turn right
      else X[i,j]:=X[i-1,j]-Y[i-1,j]+Y[i-2,j]; Y[i,j]:=Y[i-1,j]+X[i-1,j]-X[i-2,j];             # turn left
      end if;
      if (X[i,j]=X[j,j] and Y[i,j]=Y[j,j]) then L[j]:=i; break; end if; (This is wrong)
    end do;
  end do:
  return [X,Y,L];
end proc:
 

The question from is like this:
Modify the algorithm such that it stops at r[i] if r[i] = r[j] for any 0 <= j <= i-2. r=(xi,yi). M is the number of random walks and N is the number of steps. The length of the paths should be stored in L[m] (m=1..M). How do I implement the if-test correctly?

Dear All

Please see my query below:


 

Suppose I have a expression whose terms are in summation:

sum(P[n]*xi^n, n = 0 .. infinity)+(sum(P[n]*xi^n, n = 0 .. infinity))^2+sum(P[2*n+1]*P[2*n]*xi^n, n = 0 .. infinity)

sum(P[n]*xi^n, n = 0 .. infinity)+(sum(P[n]*xi^n, n = 0 .. infinity))^2+sum(P[2*n+1]*P[2*n]*xi^n, n = 0 .. infinity)

(1)

diff(sum(P[n]*xi^n, n = 0 .. infinity)+(sum(P[n]*xi^n, n = 0 .. infinity))^2+sum(P[2*n+1]*P[2*n]*xi^n, n = 0 .. infinity), xi)

sum(P[n]*xi^n*n/xi, n = 0 .. infinity)+2*(sum(P[n]*xi^n, n = 0 .. infinity))*(sum(P[n]*xi^n*n/xi, n = 0 .. infinity))+sum(P[2*n+1]*P[2*n]*xi^n*n/xi, n = 0 .. infinity)

(2)

In above summation, how I can write specific term ? For example, how I can display term for n = 2etc.

NULL


 

Download Summation.mw

Hello,
When I try to put the Gcdex in a procedure and start maplemint, then there occurs an error.

Gcdex(x^2 - 1, x - 2, x ,'s','t') mod 3;

--> works

But:

restart;
a := proc()
    Gcdex(x^2 - 1, x - 2, x ,'s','t') mod 3;
end proc;
maplemint(a);

Then there is an error I don't understand.

Error, (in maplemint/expression) not implemented POLY

By the way I have a fundamental problem to understand, where the values s and t are saved after calling Gcdex (or Quo, Rem, etc.). Till now I thought, that variables s and t are created, but when I declare s, t at the beginning as local variables and start maplemint, then there is something like:

    These parameters have the same name as constants:
      3
    These local variables were used before they were assigned a value:
      r::name, (-x-1)::name, (x-1)::name

So the names of s and t changed, they don't assign a new value? I don't understand that.

 

Hi everyone,

I need some help with the following error,

How can i solve this problem?

Thanks for your time

Best regards,

Canberk

I having a hard time with defining a vector, in order to store in it some data, then plot it and export it to a file, I copied all what's in the help instructures but it doesn't work everytime, please it's urgent for my PhD thesis !

Maple returns this: and I want to move the exp out of root so it becomes exp(

Ex3 := Pi*sqrt((4/mu+4/r)*exp(-r/mu))

and I want to move the exp out of root so it becomes exp(-r/2*mu), and I want to take the 4s out so it become 2*Pi instead of just Pi.  How do I do it? thank you for all the help

I'm trying to write some simple code to help plot an approximation of a solution to the heat equation. On one set of axes I want to plot the temperature characteristic of a 1-D bar at different temperatures. I am able to do this easily enough, but the code uses a for loop and my core i7 is not being utilized properly. To rectify this I have tried to use threads, but after many hours of playing around I cannot get it to work fully. The first time I run my code I am faced with the error "Error, (in plot) cannot determine if this expression is true or false: not fHwLibraryInitialized".

Then after this I can run my code a few more times and it will produce a graph, but each time the graph will be different, meaning most of them are incorrect. After running my display command several times I am then faced with the error "kernel connection has been lost", and I need to restary. I have never played with threads before and have very little understanding of how it works.

with(Threads);
with(plots);

para := proc (A, B)
return [op(A), op(B)]; 
 end proc;

HeatP := proc (f, g, n, lambda, X, N, M, T)
 local k, u, i, L, a; 
u := proc (x, t) options operator, arrow; sum((int(sin(k*lambda*x)*g, x = 0 .. 1))*exp(-k*lambda*t)*sin(k*lambda*x), k = 1 .. n) end proc;
 L := [];
 if N-X < 3 then for i from X to N do
 L := [op(L), plot(u(x, (i*T-T)/M), x = 0 .. 1)] 
end do; 
return L;
else a := floor((1/2)*(N-X))+X; 
Threads:-Task:-Continue(para, Task = [HeatP, f, g, n, lambda, X, a, M, T], Task = [HeatP, f, g, n, lambda, a+1, N, M, T])
 end if
 end proc;

g := piecewise(x <= 0, 0, 0 < x and x < 1, exp(-2/(1-(x-1/2)^2)), x >= 0, 0);

display(Threads:-Task:-Start(HeatP, 0, g, 5, Pi, 1, 8, 8, 2));

I cannot see where the problem is, but there is obviously at least one. Any help would be appreciated.

Hi, I have a big system with 27 polynomial equations in 16 unknowns: f_1=...=f_27=0.  I can store these equations but I cannot calculate a Grobner basis of the ideal  J generated by my polynomials (allocation problem) - I use the library "with(FGb)"-  What interests me is whether my system is minimal in the following sense.

If, for example,  I remove f_1, is the ideal generated by (f_2,...f_27)  J again ? That is to say, is f_1 in the ideal generated by f_2,...,f_27 ? I would like to get an answer "yes" or "no" for each removed  f_i.

My question: can we solve the problem above  without calculating a Grobner basis of J?

Thanks in advance.

 

 

 

 

 

is there a possibility to display the partial derivative of f(x,y) wrt. y as

and second order / cross-partials accordingly?

 

thx

jo

 

 

Hello,

my problem is, that the time or profiling results are not fine enough.

For example time is only measureable in a 16ms step on my system. Is there any way to measure time more fine, perhaps in a 1ms step or nanoseconds?

I consider  100 .100 real matrices A,B=Matrix(100,100,(i,j)->rand()) (with 12 significant digits).  In general, ConditionNumber(A) is <10^5; also I choose Digits:=17.Theoretically, the complexity of the calculations of Determinant(A), CharacteristicPolynomial(A,x), A.B and MatrixInverse(A) are similar (~n^3). Yet, the times of these calculations are respectively: 0"13, 0"67, 0"60 and, what surprises me, 75" (moreover, I don't display any result).

My question: concerning the calculation of the inverse, where does this factor 100 come from ? Would Matlab  be 100 times faster ? I do not see why this would be the case; in particular, the standard methods for the calculation of the inverse are  easily programmable.

Thanks in advance.

 

How can I sketch the angles such as Pi/6 , Pi/4 or 7Pi/6 and etc by Maple 18? In general, what is maple commend for sketching angles?

First 38 39 40 41 42 43 44 Last Page 40 of 86