## MaplePrimes Questions

Search Questions:

## How does Maple arrive at an implicit solution to i...

Equation:=int(y'(x)*w(x)) = [int([y(x)^(1/2)]*w(x))]^(-2/3) When plugging this Equation into dsolve, Maple provides the following implicit solution: Solution:= [3*y(x)^(4/3)]/4 + int[(2*y(x)^(5/6)/[3*int([(y(x)^(1/2))*w(x)]/[3*int[(y(x)^(1/2))*w(x)]^(5/3) When going to odeadvisor, the suggestion was to first convert to the form y = G(x,y'(x) and then utilize the method of 'patterns', which I could not apply to this equation. If anyone can fill in the steps between 'Equation' and 'Solution', it would be greatly, appreciated. P.S.Sadly, I am unable to attach the actual Maplesoft worksheet.

## Error (in fprintf)...

Can anyone assist with this error please?

 > #Clear memory and load package. restart;   with(LinearAlgebra): #Initialise variables,matrices and vectors. b:=<<18>,<-2>>: c:=<<1>,<1>>: i:=0: P:=<1.08,1.37,1.56,1.61>; t:=<5,10,15,20>; tol:=1e-6: #Initialise Gauss-Newton matrices. n:=Dimension(t): f:=Matrix(n,1): J:=Matrix(n,2): #Display initial parameter values. printf("Gauss-Newton Method\n"); printf("-------------------\n"); printf("Before iterations,A = %f and B = %f\n",b(1),b(2)); #Perform the Gauss-Newton method. while max(abs(evalf(c)))>tol do   i:=i+1;   for r from 1 to n do      f(r,1):=evalf((In(b(1)+t[r])+b(2))-P[r]);      J(r,1):=evalf(1/b(1)+t[r]);      J(r,2):=evalf(1); end do; c:=Multiply(MatrixInverse(Multiply(Transpose(J),J)),Multiply(Transpose(J),f)); b:=b-c; printf("After iterations %d, A = %f and B = %f\n",i,b(1),b(2)); end do:
 Gauss-Newton Method ------------------- Before iterations,A = 18.000000 and B = -2.000000 After iterations 1, A =
 >

## Error - final value in loop must be numeric or cha...

The x region is z<x<1 and y region is 0<y<pi//3, I think there is an error in the j values in the loop

 > #Clear memory. restart; #Initialise variables and arrays. h:=0.1; k:=Pi/30; c:=1: iter:=0: tol:=1e-5; w:=1.5; u:=Array(0..10,0..10): U:=Array(0..10,0..10): #Calculate boundary u values. for i from 0 to 10 do    u[i,Pi/3]:=0;    u[i,0]:=0; end do: for j from 0 to Pi/3 do    u[0,j]:=0;       u[10,j]:=sin(3*j*k)/2; end do: #Perform the Gauss-Seidel method. while c>tol do    iter:=iter+1;    if iter>99 then       printf("\nGauss-Seidel method did not converge,change w.\n");    break; end if: for i from 1 to 9 do   for j from 0 to Pi/3 do      U[i,j]:=u[i,j];      u[i,j]:=(10*Pi^2*u[i-1,j]+9*u[i,j-1]+9*u[i,j+1]+2*Pi^2*u[i+1,j])/20;      u[i,j]:=w*u[i,j]+(1-w)*U[i,j];   end do: end do: c:=max(abs(u[1..9,1..9]-U[1..9,1..9])); printf("After iteration %2d,the maximum change in u is %7.1e\n",iter,c); end do: #Display the final u values if method converged. if iter<100 then     printf("\nGauss-Seidel Method\n");     printf("-------------------\n");     for j from 10 by -1 to 0 do       for i from 0 to 10 do         printf("%6.4f",u[i,j]);     end do:     printf("\n"); end do: end if:
 Gauss-Seidel Method ------------------- 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000 0.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000
 >

## Error, (in DEtools/phaseportrait) vars must be dec...

Hello. I have a problem with the phaseportrait and I hope could help me with this:

## can you share a documet ...

can you do groupwork on a single documet

## Array error out of range...

Can anyone assist with the error please?

 > #Clear memory. restart; #Initialise variables and arrays. h:=0.1; n:=10; k:=0.1;   m:=10; t:=Array(0..m): x:=Array(0..n): u:=Array(0..n,0..m): #Initialise the x array and the initial u(x,0) boundary. for i from 0 to n do     x[i]:=i*h;     u[i,0]:=exp(x[i]); end do: #Initialise the t array and the u(x,t) side boundaries. for j from 0 to m do    t[j]:=j*k;    u[0,j]:=0;    u[n,j]:=t[j]; end do: #Use the 2D CTCS explicit wave method. for i from 1 to n-1 do    u[i,1]:=(9*u[i-1,0]+14*u[i,0]+9*u[i+1,0])/32+[i]/10; end do:   for j from 1 to m-1 do   for i from 0 to n-1 do    u[i,j+1]:=(9*u[i-1,j]+14**u[i,j]+9*u[i+1,j])/16-u[i,j-1];   end do; end do: #Display the u(x,t)values. printf("2D CTCS Explicit Wave Method\n"); printf("----------------------------\n"); printf("x\t\t t\t\t u\n"); for i from 0 to n do    printf("% f\t% f\t% f\n",x[i],t[m],u[i,m]); end do;
 2D CTCS Explicit Wave Method ---------------------------- x                 t                 u  0.000000         1.000000         0.000000  0.100000         1.000000         0.000000  0.200000         1.000000         0.000000  0.300000         1.000000         0.000000  0.400000         1.000000         0.000000  0.500000         1.000000         0.000000  0.600000         1.000000         0.000000  0.700000         1.000000         0.000000  0.800000         1.000000         0.000000  0.900000         1.000000         0.000000  1.000000         1.000000         1.000000
 >

## How to use simplify command?...

HI,
I want to simplify an algebraic experssion. How do I do this with Maple?
A1.mw

## definition of a matrix by using a function (i,j)->...

Hi,

In the code below I do not understand why f(3,1) cannot be computed : it returns the conjugate of D1[2,2] although I have defined it as a random number. Maybe you understand this ? Actually I first got an error message of the type "bad index into matrix". Thus I wrote ''D1''[t, t] instead of D1[t, t] to fix the issue in the product.

with(LinearAlgebra);
D1 := evalf(RandomMatrix(3));
f := (i, j) -> if i = j then D1[i, i]; elif i = j + 1 then (1 - abs(D1[i, i])^2)^(1/2)*(1 - abs(D1[j, j])^2)^(1/2); elif j + 1 < i then (1 - abs(D1[i, i])^2)^(1/2)*(1 - abs(D1[j, j])^2)^(1/2)*product(-conjugate(''D1''[t, t]), t = j + 1 .. i - 1); else 0; end if;
f(1, 1);
f(1, 2), f(1, 3);
f(2, 2);
f(2, 3);
f(3, 3);
f(2, 1);
f(3, 2);
f(3, 1);
Modu := evalf(Matrix(3, (i, j) -> f(i, j)));

f(3,1) is given by 3222.984487*conjugate(D1[2, 2]): I do not get why the value of D1[2,2] is ignored.

## How to use plot3d...

Dear Colleagues,

I wish to use plot3d to the attached code but always encoutered error. However, pointplot3d runs perfectly. Please I need your assistance in this regards.

Thank you all and best regards.K2_Problem_2_two_body_kepler_e=0.mw

## MemoryInUse() slow and seemed weird....

I have been using 'MemoryInUse()' to try to track down a memory leak that is crashing my Maple-based simulation. The problematic proc seems to be ProbDStarLNu which calculates the probablity of decay as a function of the angles of the decay product. It gets called a lot in acceptance rejection decay generation.

'MemoryInUse()' slows it down a lot. It also seemed to give weird results to me. I calculate the mem used on entry and then after the 4 trig functions have been called. The amount of mem 'in use' goes down after the trig functions are called. I was suspecting they were the source of the leak, but they seem almost an anti-leak.

This weird behavior caused me to write my own mem counting proc ('memUsed') based on summing over the results of 'mem:= kernelopts(memusage)'.

It is much faster. It gives nearly but not quite the same numbers. It still goes "backward" when the trig functions are called. Most of the mem growth comes from the algebra that follows the trig.

Why would that be?

I have included code for 'ProbDStarLNu'. It's pretty simple.

## Integration with Whittaker...

I have been having problem in solving this question because of the 'Whittaker'.

Can anyone please asist me how to integrate below problem with the 'Whitaker?

f := exp(-1.5*t)*(GAMMA(2)*t^(2-alpha)/GAMMA(3-alpha)-t^(1-alpha)/GAMMA(2-alpha)+t^2-t);
/   (2 - alpha)        (1 - alpha)           \
|  t                  t                 2    |
exp(-1.5 t) |---------------- - ---------------- + t  - t|
\GAMMA(3 - alpha)   GAMMA(2 - alpha)         /
int(f, t);

2.^(3.-1.*alpha)*3.^(alpha-3.)*(t^(-.5000000000*alpha)*3.^(-.5000000000*alpha)*2.^(.5000000000*alpha)*(alpha-3.)*(-2.+alpha)*exp(-.7500000000*t)*WhittakerM(-.5000000000*alpha, -.5000000000*alpha+.5000000000, 1.500000000*t)/(3.-1.*alpha)+t^(-.5000000000*alpha)*3.^(-.5000000000*alpha)*2.^(.5000000000*alpha)*(1.500000000*t-1.*alpha+2.)*(alpha-3.)*exp(-.7500000000*t)*WhittakerM(-.5000000000*alpha+1., -.5000000000*alpha+.5000000000, 1.500000000*t)/(3.-1.*alpha))/GAMMA(3.-1.*alpha)-1.*2.^(2.-1.*alpha)*3.^(-2.+alpha)*(t^(-.5000000000*alpha)*3.^(-.5000000000*alpha)*2.^(.5000000000*alpha)*exp(-.7500000000*t)*WhittakerM(-.5000000000*alpha, -.5000000000*alpha+.5000000000, 1.500000000*t)+t^(-.5000000000*alpha)*3.^(-.5000000000*alpha)*2.^(.5000000000*alpha)*(-2.+alpha)*exp(-.7500000000*t)*WhittakerM(-.5000000000*alpha+1., -.5000000000*alpha+.5000000000, 1.500000000*t)/(2.-1.*alpha))/GAMMA(2.-1.*alpha)+.1481481481+(0.9876543210e-1*(-6.750000000*t^2-9.*t-6.))*exp(-1.500000000*t)-(.2222222222*(-2.-3.*t))*exp(-1.500000000*t)

## infinite series expansion of incomplete upper gamm...

I want infinite series expansion of incomplete upper gamma function.

## Is this a broken link?...

I clicked on the author's page link and was redirected to front page instead. Does this link work? Why does it not work for me?

How to define constants - MaplePrimes

## CodeTools[Profile] --Can't get it to work...

I'm trying to use CodeTools[Profile] to investigate my memory leak and the effect or lack there of of 'forget' to improve it.

I copied my code from an example:

with(CodeTools[Profiling]);
[Allow, Build, Coverage, GetProfileTable, Ignore, IsProfiled,

SaveProfiles, Select, SortBy, UnProfile]

Profile([PickAngles(1.0, 1.0, 1.0)]);
Error, (in CodeTools:-Profiling:-Profile) unexpected argument(s)

The 'unexpected argument' is the 'result' from 'PickAngles'. I've tried with and w/o the '[]' but it does the same thing failing to recognize that 'PickAngles' is a procedure.

The example I used is here:

https://www.maplesoft.com/support/help/maple/view.aspx?path=CodeTools%2FProfiling%2FProfile procedure.

I did what to make of the subscript Profiles in the example so I used '[Profiles]' and that worked or seemed to.