Maple 2016 Questions and Posts

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

I have recently been working on a problem using fractional calculus and have come across something in Maple's fracdiff  command that makes no sense to me.

fracdiff(1, x, 1/2) = 0

It should be:     1/(sqrt(x)*sqrt(Pi))

Thanks.

fracdiff.mw

The first half of this work sheet deals with SHM of pendulum. In the second half of the work sheet I attempt to solve for the general case of a swinging pendulum. Maple introduces a place holder (correct me if I have used the incorrect termonology) " __a" which I do not understand. What variable(s) should I replace it with and is there an automatic way of doing so?
 

restart

NULL

``

``

Simple*Harmonic*Motion*of*a*Pendulum

NULL

Eq1 := diff(Theta(t), t, t) = -omega^2*Theta(t)

diff(diff(Theta(t), t), t) = -omega^2*Theta(t)

(1)

ics := Theta(0) = 0, (D(Theta))(0) = Vmax

Theta(0) = 0, (D(Theta))(0) = Vmax

(2)

SHM := dsolve({Eq1, ics})

Theta(t) = Vmax*sin(omega*t)/omega

(3)

diffSHM := diff(SHM, t)

diff(Theta(t), t) = Vmax*cos(omega*t)

(4)

convert(diffSHM, D)

(D(Theta))(t) = Vmax*cos(omega*t)

(5)

eval[recurse](%, {t = 0, (D(Theta))(0) = Vmax})

Vmax = Vmax

(6)

solve(%, {_C1})

{_C1 = _C1}

(7)

assign(%); _C1

_C1

(8)

``

SHM

Theta(t) = Vmax*sin(omega*t)/omega

(9)

``

(General*Equation*of*Motion*of)*a*Pendulum

restart

diff(Theta(t), t, t) = -omega^2*sin(Theta(t))

diff(diff(Theta(t), t), t) = -omega^2*sin(Theta(t))

(10)

ics := Theta(0) = 0, (D(Theta))(0) = Vmax

Theta(0) = 0, (D(Theta))(0) = Vmax

(11)

Sol := dsolve(diff(Theta(t), t, t) = -omega^2*sin(Theta(t)))

Intat(1/(2*omega^2*cos(_a)+_C1)^(1/2), _a = Theta(t))-t-_C2 = 0, Intat(-1/(2*omega^2*cos(_a)+_C1)^(1/2), _a = Theta(t))-t-_C2 = 0

(12)

Sol[1]

Intat(1/(2*omega^2*cos(_a)+_C1)^(1/2), _a = Theta(t))-t-_C2 = 0

(13)

_C2 := 0

0

(14)

Sol[1]

Intat(1/(2*omega^2*cos(_a)+_C1)^(1/2), _a = Theta(t))-t = 0

(15)

``

dffSol[1] := diff(Sol[1], t)

(diff(Theta(t), t))/(2*omega^2*cos(Theta(t))+_C1)^(1/2)-1 = 0

(16)

``convert(dffSol[1], D)

(D(Theta))(t)/(2*omega^2*cos(Theta(t))+_C1)^(1/2)-1 = 0

(17)

 

eval[recurse](%, {t = 0, Theta(0) = 0, (D(Theta))(0) = Vmax})

Vmax/(2*omega^2+_C1)^(1/2)-1 = 0

(18)

solve(%, {_C1})

{_C1 = Vmax^2-2*omega^2}

(19)

assign(%); 1; _C1

Vmax^2-2*omega^2

(20)

dffSol[1]

(diff(Theta(t), t))/(2*omega^2*cos(Theta(t))+Vmax^2-2*omega^2)^(1/2)-1 = 0

(21)

``

dsolve(dffSol[1]); 1; SOL1 := int((diff(Theta(t), t))/sqrt(2*omega^2*cos(Theta(t))+Vmax^2-2*omega^2)-1, t = 0 .. Theta(t)) = 0

int((diff(Theta(t), t))/(2*omega^2*cos(Theta(t))+Vmax^2-2*omega^2)^(1/2)-1, t = 0 .. Theta(t)) = 0

(22)

Sol[1]

Intat(1/(2*omega^2*cos(_a)+Vmax^2-2*omega^2)^(1/2), _a = Theta(t))-t = 0

(23)

"Using  ( 1-cos(theta))/(2)=sin(theta/(2))^(2)and substituting by hand"

NotsoSHM := Intat(1/(Vmax*sqrt(1-2*omega^2*sin((1/2)*_a)^2/Vmax^2)), _a = (1/2)*Theta(t))-t = 0

Intat(1/(Vmax*(1-2*omega^2*sin((1/2)*_a)^2/Vmax^2)^(1/2)), _a = (1/2)*Theta(t))-t = 0

(24)

``

``


 

Download SHM_and_not_so_SHM.mw

I am practicing with some diff equations. I am having problem solving for one of the constants. I am having a pproblem assigning a value to derivatives or 2nd derivatives. What is a good general technique is this type of situation?
 

restart

NULL

``

omega^2 = g/l

omega^2 = g/l

(1)

Eq1 := diff(Theta(t), t, t) = -omega^2*Theta(t)

diff(diff(Theta(t), t), t) = -omega^2*Theta(t)

(2)

ics := Theta(0) = 0, (diff(Theta(t), t))(0) = Vmax, (diff(Theta(t), t, t))(0) = 0

Theta(0) = 0, (diff(Theta(t), t))(0) = Vmax, (diff(diff(Theta(t), t), t))(0) = 0

(3)

SHM := dsolve({Eq1, ics})

(4)

SHM := dsolve({Eq1})

{Theta(t) = _C1*sin(omega*t)+_C2*cos(omega*t)}

(5)

SHM := dsolve({Eq1, Theta(0) = 0})

Theta(t) = _C1*sin(omega*t)

(6)

``

diffSHM := diff(SHM, t)

diff(Theta(t), t) = _C1*omega*cos(omega*t)

(7)

``

(Theta(t))(0) = 0, (diff(Theta(t), t))(0) = V

(Theta(t))(0) = 0, (diff(Theta(t), t))(0) = V

(8)

``

``

``

``

``

NULL

NULL


 

Download SHM.mw

I was trying to write a procedure that would compute a simple linear equation using the Extended Euclidean Algorithm. I was thinking of a procedure like the following:

solveEeaMatrix := proc (a::list, b::list) 
 local c::list;  
 c := a -iquo(a[1],b[1])*b;  
 print(c);  
 while (c[1] <> gcd(a[1],b[1]) do 
 ...

I am basically stuck at this part as

1) I don't know how to setup a multi-dimensional array that could dynamically grow(as a possible solution).

2) I can't come up with a recursive function that could possibly take care of this.

In short, if I am given for example an equation like: 84*x+203*y = 14

I will transform it into 2 linear equation as follow:
row0 := [203, 0, 1] row1 := [84, 1, 0] Subsequently, I will perform the following:

c := a -iquo(a[1],b[1])*b;  

Where aand b are both lists and arguments of the procedure and cbeing another list and a local variable.

But I don't know how to do the following programmatically:

row3 := row1-iquo(row1[1], row2[1])*row2;
row4 := row2-iquo(row2[1], row3[1])*row3;
row5 := row3-iquo(row3[1], row4[1])*row4;
and so on ...                  

Any hint would be appreciated.

Dear All, 

I am trying to use define_external to use a C dll from inside MAPLE. The C dll exports a function that has a argument of type function pointer which has a return type of pointer. The function itself returns pointers.  

Pointers are needed as return types as the C function needs to return arrays. 

When I try to pass the C function, as maple procedure as the argument, it errs saying "Error, (in rk4_vec) number expected for float[8] parameter, got proc () option remember; table( [( 1 ) = HFloat(1.0), ( 2 ) = HFloat(-0.0) ] ) 'procname(args)' end proc"

rk4_vec is as follows: 

rk4_vec := define_external("rk4vec", 't0' :: float[8], 'm' :: integer[4], 'u0' :: ARRAY(1..2,datatype=float[8]), 'dt' :: float[8], 'f' :: PROC('t' :: float[8], 'm' :: integer[4], 'u' :: ARRAY(1..2,datatype=float[8]), 'RETURN' :: REF(float[8])), 'RETURN' ::REF(float[8]), "WRAPPER", LIB="rk4.dll");

rk4vec in C looks like this: 

double *rk4vec ( double t0, int m, double u0[], double dt, 
  double *f ( double t, int m, double u[] ) )

I am passing as :

rk4vec_test_f := proc(t, n, u)
local uprime :: REF(float[8]);
#uprime := Array(n);
uprime(1) := u(2);
uprime(2) := -u(1);
return uprime;
end proc;

I have tried the RETURN type on the define_external call as : float[8], ARRAY(1..2, datatype=float[8]) , but that didnt work either. I got the idea of using REF from times2 example on this link.

Any guidance in this matter is highly appreciated. 

Attached are the C file, the dll, maple worksheet. Tested on Windows, with 64-bit, Maple 2016 standard. rk4.zip

 

Funny, I can't seem to find a list of all available units in the help file.

Is there not a listed table of units somewhere?

**edit add**  conversion of units I mean.  ie.  meters, miles, gallons, litres, Pa, etc...

I wish to solve for k interms of x, e is a constant in the equation k=x+e*sin(k). Using the solve function, i got 

RootOf(_Z-x-e*sin(_Z)) and using the function allvalues(RootOf(_Z-x-e*sin(_Z))) still gave the same expression in _Z. Please is there a way out because I need the value of  as a substitute to another equation. Any help will be highly appreciated.
 

I am trying to model a disease. The equation is as follows:

S*X - f(X,S,Sp) = 100

I have data for S, I have data for X and I have data for f(X,S,Sp) however I want to find an equation for f(X,S,Sp) that has the best fit with the data because I need to use it later on in my calculation. If anyone is intrested S is the sensitivity of the blood test, Sp is the specificity of the blood test. This means that X*(1-Sp) is the number of false positives.

I currently dont have access to Maple hence I am doing all my modeling in excel 2016. So I am severly limited because excel is useless at algebra.

Maple.xlsx

I use maple 2016 on linux with X.  When minimized, the maple icon is very small.  Also, the help icon is very small.

Are larger icons available?

The maple icon is ./bin/Maple2016.png.  I can not find the help icon.  Any ideas?

I have a PDE with boundary conditions, from a NASA paper.  I always seem to have problems expressing the bc.

PDE := diff(u(x, t), t) = (1/4)*exp(2)*exp(-u(x, t))*(diff(diff(u(x, t), x), x))/(x^2+2);

The initial/boundary conditions are

@t=0, u(x, t) = 2-2*ln(-x^2+2)

@x=0, diff(u(x,t),x)=0  ## this is the bc I have problem expressing

@x=1, u(x,t) = 2+ln(1+t)

The exact solution given in the paper:

2 + ln(1+t) - 2*ln(2-x^2)

I tried

ics := u(x, 0) = 2*(1-ln(2-x^2));

bcs := D[1](u(0,t))=0, u(1,t)=2+ln(1+t);

PDEtools[Solve]([PDE,ics,bcs]); ## no solution

How do I do this?

Tom Dean

We have just released an update to Maple.  It includes updates to the Maple Workbook, the video component, the Physics package, and many other small improvements throughout the product. It is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2016.2 download page.

eithne

Greetings

How can I get LPSolve to output the unique subsets of {3,1,1,2,2,1} which sum to 5 (no recycling of set values)

partition.mw

(the code is a Yury/Love hybrid).

hi.

please help me for remover this problem.

''''

-Float(infinity)*signum((5.*A3*A1-24.*A2^2)*A1/A2^2)''''

ReducedCantiler.mw
 

restart

f := -(2/3)*eta^3+(1/2)*eta^2+eta; -1; g := -eta^2+1; -1; h := -eta^2+1; 1; F := proc (eta) options operator, arrow; A1*f end proc; 1; G := proc (eta) options operator, arrow; A2*g end proc; 1; H := proc (eta) options operator, arrow; A3*h end proc

proc (eta) options operator, arrow; A3*h end proc

(1)

Q1 := diff(F(eta), eta, eta, eta)+.5*H(eta)*((diff(F(eta), eta))^2+F(eta)*(diff(F(eta), eta, eta)))/G(eta)^2+2*(diff(G(eta), eta))*(diff(F(eta), eta, eta))/G(eta)-(diff(H(eta), eta))*(diff(F(eta), eta, eta))/H(eta); 1; Q2 := diff(G(eta), eta, eta)+H(eta)*((diff(F(eta), eta))*G(eta)+.5*F(eta)*(diff(eta, eta)))/G(eta)^2+2*(diff(G(eta), eta))^2/G(eta)-((diff(H(eta), eta))*(diff(H(eta), eta)))/H(eta)+(diff(F(eta), eta, eta))^2-(H(eta)/G(eta))^2; 1; Q3 := diff(H(eta), eta, eta)+(.5*1.3)*H(eta)*(5*(diff(F(eta), eta))*H(eta)+F(eta)*(diff(H(eta), eta)))/G(eta)^2+2*(diff(G(eta), eta))*(diff(H(eta), eta))/G(eta)-(diff(H(eta), eta))^2/H(eta)+(1.3*1.44)*H(eta)*(diff(F(eta), eta, eta))/G(eta)-(1.3*1.92)*(H(eta)/G(eta))^3

-2*A3+.65*A3*(5*A1*(-2*eta^2+eta+1)*A3*(-eta^2+1)-2*A1*(-(2/3)*eta^3+(1/2)*eta^2+eta)*A3*eta)/((-eta^2+1)*A2^2)+4*A3*eta^2/(-eta^2+1)+1.872*A3*A1*(-4*eta+1)/A2-2.496*A3^3/A2^3

(2)

Eq1 := int(Q1*f, eta = 0 .. 1);

-0.2600000000e-1*A3*(24.*A1*A2^2-65.*A1*A2*A3+64.*A3^2)/A2^3

(3)

sol := solve({Eq1 = 0, Eq2 = 0, Eq3 = 0}, {A1, A2, A3}); J := min(select(`>`, sol, 0))

Error, invalid input: `>` expects 2 arguments, but received 1

 

A11 := evalf(simplify(sol[1, 1])); A22 := evalf(simplify(sol[1, 2])); A33 := evalf(simplify(sol[1, 3]))

Error, invalid subscript selector

 

``


 

Download ReducedCantiler.mw

 

How to find the integral of (x+y)/(x+y+z) over the part of the unit ball  centered at the origin which lies in the positive octant { x>=0 , y>=0, z>=0 } ? Numeric calculations suggest Pi/9.

2 3 4 5 6 7 8 Last Page 4 of 28