Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

DEAR SIR,

PLEASE HELP ME WITH THAT QUESTION

I have a gensym routine (gensym = generate symbol) which appends Chinese characters to some base symbols to create 'new' symbols.  This works well on Windows, Mac and tty maple.  But I get all square boxes in the linux GUI.

I know the fonts exist as, on the same machine, it works in tty.  But I have no idea how to tell the GUI to go and use those fonts.  Nor why it isn't.

Amusingly, if I try to paste something from the GUI as MapleMath here on Primes, in the 'paste' box, it shows just fine, but then it says it is invalid Maple.

For example, from the GUI I see

but the same thing in TTY is

(x三0不 + x三1下)^(-M)

and I just did cut-and-paste of the same thing.  By this I mean that I took that output with boxes above, put it into a terminal window, re-copied that, pasted it in here, and voila!

So clearly the issue is with the GUI, and only on linux (Ubuntu 16.04).

I watched a webinar training:   Maple Training for Engineers, Researchers, and Scientists.

 

The file demonstrated topics and used collapsible regions with a colored band across the document and a + / - sign on the left to open/close the section or region.  Different than the document gray down arrow.

 

I have searched all the documentation and can not find how to do this.   I have done this in other programs like MathCAD to close and lock a region from viewing or editing of specific formulas.

 

Any help always appreciated.

 

Regards,

Bill

I'm currently working on building a Grid Layout for a project, and I'm having trouble coding in the RunWindow and GetFile elements into buttons under the grid layout. I've gone through the overviews and examples for them, but had no luck. I'm using Maple 2016.1 for OS X.

Additionally, the structure of the code is slightly different as to how many of the example worksheets structure their Grid Layout code, since the code originated from a Maplet Builder file. I.e. in the example worksheets they would follow as:

maplet := Maplet('onstartup' = 'Action1', 'reference' = 'Maplet1',
         BoxLayout('background' = "#D6D3CE", 'border' = 'false', 'halign' = 'center', 'inset' = '5', 'reference' = 'BoxLayout1', 'valign' = 'center', 'vertical' = 'false', 'visible' = 'true',
                       BoxColumn( BoxCell('hscroll' = 'never', 'value' = 'Button1', 'vscroll' = 'never'),
         GridLayout('background' = "#D6D3CE", 'border' = 'false','halign'='center','inset'='5', 'reference' = 'GridLayout1', 'valign' = 'center', 'visible' = 'true',
                   GridRow('valign' = 'top', GridCell('height' = '1', 'hscroll' = 'never', 'value' = 'BoxLayout1', 'vscroll' = 'never', 'width' = '1' ))),
         Window('layout'= 'GridLayout1', 'reference' = 'W1', 'resizable' = 'true', 'title' = "Maplet"),
          Action('reference' = 'Action1', RunWindow('window'= 'W1'))

However the structure for the code I am working with has action at the very start of the code, follwed by the the code for the buttons then layouts/window.  E.g. (the code has been shortened)

with (Maplets[Elements]):
maplet :=
Maplet('onstartup'='Action1','reference'='Maplet1',
Action('reference'='clickButton1'),
Action('reference'='clickButton9',
Evaluate('function'='plot3d(x^2*cos(y),x = -1 .. 1,y = -2*Pi .. 2*Pi)','target'='Plotter1','waitforresult'='true')),
Action('reference'='clickButton11'),
Action('reference'='clickButton12'),
Action('reference'='clickButton10'),
Button('background'="#D6D3CE",'caption'="Insert Molecular Geometry",'enabled'='true','foreground'="#000000",'onclick'='clickButton1','reference'='Button1','visible'='true'),

....

BoxLayout('background'="#D6D3CE",'border'='false','halign'='center','inset'='5','reference'='BoxLayout1','valign'='center','vertical'='false','visible'='true',
BoxColumn(
BoxCell('hscroll'='never','value'='Button1','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout2','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout3','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout9','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout14','vscroll'='never')),
BoxColumn(
BoxCell('hscroll'='never','value'='Label3','vscroll'='never'),
BoxCell('hscroll'='never','value'='Plotter1','vscroll'='never'),
BoxCell('hscroll'='never','value'='Slider1','vscroll'='never'))),
GridLayout('background'="#D6D3CE",'border'='false','halign'='center','inset'='5','reference'='GridLayout1','valign'='center','visible'='true',
GridRow('valign'='top',
GridCell('height'='1','hscroll'='never','value'='BoxLayout1','vscroll'='never','width'='1'))),
Window('layout'='GridLayout1','reference'='Window1','resizable'='true','title'="Maplet"),
Action('reference'='Action1',
RunWindow('window'='Window1'))):

Maplets[Display](maplet);

 

If anyone would be able to provide an example of code or some guidance I could follow that would be greatly appreciated! 

MAPLE 15 on Windows 10

I have a file on which I can no longer open. This happened after my computer made me long on again after being gone for a little while. Maple was not running when I got back on. This is not unusal and I just clinck on the file and restart.

This time this did not work.

It comes up with a message asking me to select an input mode. Whatever I select even 'Plain text' it just hangs.

I'd send you an image, but I don't see how to do it. The button provide only allows for something with  url and the snip I made is on my desktop.

I need to get thiis worksheet back. I've put a lot of effort into it.

-Traruh

After running Maple in a shell file, I come up with this error that I do not understand on my Mac,

gap_long := 0.117647058823529 Pi

gap_lat := 0.0588235294117647 Pi

lat_begin := 0.441176470588235 Pi

long_begin := -Pi

lat_begin_0 := 0.441176470588235 Pi

long_begin_0 := -Pi

long_max := 0.882352941176471 Pi

lat_max := -0.441176470588235 Pi

33

Warning, `parameter` is implicitly declared local to procedure `set_par_eff`

distance eff distance_eff
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
Im in has par
Im in has par
Error, invalid input: eval expects its 2nd argument, eqns, to be of type
{integer, equation, set(equation)}, but received par_eff_post
13

32

31

17

hou := 0

mini := 0

seci := 0

memory used=4.0MB, alloc=32.3MB, time=0.23



If needed, I can attach more files if my question is still a bit too cryptic. Please let me know asap as this is urgent. Thank you so much,
-Z

hi.please help me for solve this equation

i encounter with error''

Error, (in StringTools:-IsPrefix) second argument must be a string''

equations which be solved attached as pdf file

thanks

Kernel4.mw

root.pdf


 

restart

with(LinearAlgebra):

Typesetting:-Settings(functionassign=false):

NULL

Constants

 

landa := 0.404e11; -1; mu := 0.27e11; -1; alpha := 0.23e-4; -1; rho := 2707; -1; k := 204; -1; c := 903; -1; nu := .3; -1; E := 0.70e11; -1; T0 := 293; -1; omega := 0.1e-1

0.1e-1

(1.1.1)

beta := alpha*(3*landa+2*mu):

NULL

varpi := 0.1e-1; -1; No := 15

15

(1.1.2)

 

 

Eq[1] := besselj(0, xi*b)*(eval(diff(bessely(0, xi*r), r), r = a))-(eval(diff(besselj(0, xi*r), r), r = a))*bessely(0, xi*b):

 

wf1 := unapply(Eq[1], xi):

1

 

1.794010904

 

1

 

2

 

1.794010904

 

1

 

3

 

4.802060761

 

2

 

4

 

4.802060761

 

2

 

5

 

4.802060761

 

2

 

6

 

7.908961712

 

3

 

7

 

7.908961712

 

3

 

8

 

7.908961712

 

3

 

9

 

11.03509457

 

4

 

10

 

11.03509457

 

4

 

11

 

11.03509457

 

4

 

12

 

11.03509457

 

4

 

13

 

14.16798650

 

5

 

14

 

14.16798650

 

5

 

15

 

14.16798650

 

5

 

16

 

17.30400975

 

6

(1.2.1)

Eq[2] := MTM:-besselj(1, eta*b)*(eval(diff(MTM:-bessely(1, eta*r), r), r = a))-(eval(diff(MTM:-besselj(1, eta*r), r), r = a))*MTM:-bessely(1, eta*b):

wf2 := unapply(Eq[2], eta):

1

 

1.958510605

 

1

 

2

 

1.958510605

 

1

 

3

 

4.857021628

 

2

 

4

 

4.857021628

 

2

 

5

 

4.857021628

 

2

 

6

 

7.941288451

 

3

 

7

 

7.941288451

 

3

 

8

 

7.941288451

 

3

 

9

 

11.05802155

 

4

 

10

 

11.05802155

 

4

 

11

 

11.05802155

 

4

 

12

 

11.05802155

 

4

 

13

 

14.18576207

 

5

 

14

 

14.18576207

 

5

 

15

 

14.18576207

 

5

 

16

 

17.31852918

 

6

(1.2.2)

 

for m to MM do K0[m] := proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc; KK0[m] := proc (r, m) options operator, arrow; diff(K0[m](r, m), r) end proc; K1[n] := proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc; KK1[n] := proc (r, n) options operator, arrow; diff(K1[n](r, n), r) end proc end do

proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc

 

proc (r, m) options operator, arrow; MTM:-diff(K0[m](r, m), r) end proc

 

proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc

 

proc (r, n) options operator, arrow; MTM:-diff(K1[n](r, n), r) end proc

 

proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc

 

proc (r, m) options operator, arrow; MTM:-diff(K0[m](r, m), r) end proc

 

proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc

 

proc (r, n) options operator, arrow; MTM:-diff(K1[n](r, n), r) end proc

 

proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc

 

proc (r, m) options operator, arrow; MTM:-diff(K0[m](r, m), r) end proc

 

proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc

 

proc (r, n) options operator, arrow; MTM:-diff(K1[n](r, n), r) end proc

 

proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc

 

proc (r, m) options operator, arrow; MTM:-diff(K0[m](r, m), r) end proc

 

proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc

 

proc (r, n) options operator, arrow; MTM:-diff(K1[n](r, n), r) end proc

 

proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc

 

proc (r, m) options operator, arrow; MTM:-diff(K0[m](r, m), r) end proc

 

proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc

 

proc (r, n) options operator, arrow; MTM:-diff(K1[n](r, n), r) end proc

 

proc (r, m) options operator, arrow; BesselJ(0, xi[m]*r)*BesselY(0, xi[m]*b)-BesselJ(0, xi[m]*b)*BesselY(0, xi[m]*r) end proc

 

proc (r, m) options operator, arrow; MTM:-diff(K0[m](r, m), r) end proc

 

proc (r, n) options operator, arrow; BesselJ(1, eta__n*r)*BesselY(1, eta__n*b)-BesselJ(1, eta__n*b)*BesselY(1, eta__n*r) end proc

 

proc (r, n) options operator, arrow; MTM:-diff(K1[n](r, n), r) end proc

(1.2.3)

U1 := -(int(r*K0[m]*(diff(K1[n], r)+K1[n]/r), r = a .. b))/(int(r*K0[m]^2, r = a .. b)); -1; U2 := -(int(r*K1[n]*(diff(K0[m], r)), r = a .. b))/(int(r*K1[n]^2, r = a .. b)); -1; U3 := (int(r^2*omega^2*K1[n], r = a .. b))/(int(r*K1[n]^2, r = a .. b))

0.1555555555e-3/K1[0]

(1.2.4)

m := 0; -1; for m to MM do M__m := int(r*K1[m](r, m)^2, r = a .. b); bb__m := 1/M__m end do

int(r*K1[1](r, 1)^2, r = 1 .. 2)

 

1/(int(r*K1[1](r, 1)^2, r = 1 .. 2))

 

int(r*K1[2](r, 2)^2, r = 1 .. 2)

 

1/(int(r*K1[2](r, 2)^2, r = 1 .. 2))

 

int(r*K1[3](r, 3)^2, r = 1 .. 2)

 

1/(int(r*K1[3](r, 3)^2, r = 1 .. 2))

 

int(r*K1[4](r, 4)^2, r = 1 .. 2)

 

1/(int(r*K1[4](r, 4)^2, r = 1 .. 2))

 

int(r*K1[5](r, 5)^2, r = 1 .. 2)

 

1/(int(r*K1[5](r, 5)^2, r = 1 .. 2))

 

int(r*K1[6](r, 6)^2, r = 1 .. 2)

 

1/(int(r*K1[6](r, 6)^2, r = 1 .. 2))

(1.2.5)

MM; 1; n; 1; m; 1; U1; 1; U2; 1; U3; 1; xi

6

 

0

 

7

 

-(2/3)*K1[0]/K0[7]

 

0

 

0.1555555555e-3/K1[0]

 

xi

(1.2.6)

for m to MM do for n to MM do dsys := {diff(S[m][n](t), t, t, t)+xi^2*[m]*(diff(S[m][n](t), t, t))+(-U1*U2+`η__η__n__`^2)*(diff(S[m][n](t), t))+xi[m]^2*`η__η__n__`^2*S[m][n](t) = -(2*U2*bb[m]/(Pi*xi[m])*(-BesselJ(0, xi[m]*b)/BesselJ(1, xi[m]*a)))*q+xi^2*[m]*U3} end do end do; sol := dsolve(dsys)

Error, (in StringTools:-IsPrefix) second argument must be a string

 

 

NULL

for m to MM do for n to MM do dsys2 := {diff(Q__mn(t), t, t, t)+xi[m]^2*(diff(Q__mn(t), t, t))+(-U1*U2+eta__n^2)*(diff(Q__mn(t), t))+xi[m]^2*eta__n^2*Q__mn(t) = -2*BesselJ(0, xi[m]*b)*U1*U2*b__m*(1-exp(-xi[m]^2*t))/(BesselJ(1, xi[m]*a)*Pi*xi[m]^3)} end do end do;

sol2 := dsolve(dsys2)

Error, (in dsolve) invalid input: `PDEtools/sdsolve` expects its 1st argument, SYS, to be of type Or(set({`<>`, `=`, algebraic}), list({`<>`, `=`, algebraic}), `casesplit/ans`(list, list)), but received [{Q__mn(t)*pochhammer(1-n, n)+(1497143767/5000000)*(diff(Q__mn(t), [`$`(t, t)]))+eta__n^2*(diff(Q__mn(t), t))+(1497143767/5000000)*eta__n^2*Q__mn(t) = 0}]

 

``

NULL

NULL

 

Download Kernel4.mw

I'm tryinv to find the contents of specific bins in a maple histogram. I don't find this elementary 'function' anywhere in the help.

How do I do it? Surely it's possible w/o taking a ruler to the screen...

 

 

Hi, I want to ask. the maple program that i have done have something wrong somewhere.

for an example changes basis

 from e_{1}e_{1}=e_{1} , e_{1}e_{2}=e_{2} maple program reading :A1 : (1,1,1)=1,B1: (1,2,2)=1

to e_{2}e_{2}=e_{2} , e_{2}e_{1}=e_{1} maple program reading :A2: (2,2,2)=1,B2: (2,1,1)=1

these changes basis above are 2 operation, left product and right product

A1 and A2 are left product, while B1 and B2 are right product,

i need to make A1 isomorphic to A2, and B1 isomorphic to B2.

by using maple program, i should get identity in matrix form 2x2

[0 1] but i get [0         1]

[1 0],            [C_{21} 0],

For isomorphism, the determinant should not be zero

here's are my maple program:

>isom := proc (A1, A2, B1, B2, n)

local i, j, k, s, r, eqns, t, TEST, BChange, sols, m, S1, S2, C;

C := matrix(n, n);

BChange := matrix(n, n);

TEST := 0; eqns := {};

for i to n do for j to n do for m to n do

S1 := sum(A1[i, j, k]*C[k, m], k = 1 .. n); S2 := sum(C[i, r]*(sum(A2[r, s, m]*C[j, s], s = 1 .. n)), r = 1 .. n);

eqns := `union`(eqns, {S1 = S2})

end do end do end do;

for i to n do for j to n do for m to n do

S1 := sum(B1[i, j, k]*C[k, m], k = 1 .. n); S2 := sum(C[i, r]*(sum(C[j, s]*B2[r, s, m], s = 1 .. n)), r = 1 .. n);

eqns := `union`(eqns, {S1 = S2})

end do end do end do;

sols := [solve(eqns)];

t := nops(sols);

for i to t do for j to n do for k to n do

BChange[k, j] := subs(sols[i], C[k, j])

end do end do;

if simplify(linalg:-det(BChange)) <> 0 then print("BChange", BChange);

print("s1", S1); print("s2", S2); print("The det is", simplify(linalg:-det(BChange)));

TEST := 1 end if end do;

if TEST = 0 then print("These two algebras are not isomorphic")

end if end proc

input maple program:

> DENDA1 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 1, 1) = 1]);
> DENDB1 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 2, 2) = 1]);
> DENDA2 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(2, 2, 2) = 1]);
> DENDB2 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(2, 1, 1) = 1]);
> isom(DENDA1, DENDA2, DENDB1, DENDB2, 2);

Dear All,

I am going to solve the following systems of ODEs but get the error: Newton iteration is not converging.
Could you please share your idea with me. In the case of AA=-0.2,0,0.2,0.4,...; I could get the solution.
Thank you in advance.


restart;
with(plots);
Pr := 2; Le := 2; nn := 2; Nb := .1; Nt := .1; QQ := .1; SS := .1; BB := .1; CC := .1; Ec := .1; MM := .2;AA:=-0.4;

Eq1 := diff(f(eta), `$`(eta, 3))+f(eta).(diff(f(eta), `$`(eta, 2)))-2.*nn/(nn+1).((diff(f(eta), eta))^2)-MM.(diff(f(eta), eta)) = 0; Eq2 := 1/Pr.(diff(theta(eta), `$`(eta, 2)))+f(eta).(diff(theta(eta), eta))-4.*nn/(nn+1).(diff(f(eta), eta)).theta(eta)+Nb.(diff(theta(eta), eta)).(diff(h(eta), eta))+Nt.((diff(theta(eta), eta))^2)+Ec.((diff(f(eta), `$`(eta, 2)))^2)-QQ.theta(eta) = 0;
Eq3 := diff(h(eta), `$`(eta, 2))+Le.f(eta).(diff(h(eta), eta))+Nt/Nb.(diff(theta(eta), `$`(eta, 2))) = 0;

bcs := f(0) = SS, (D(f))(0) = 1+AA.((D@@2)(f))(0), theta(0) = 1+BB.(D(theta))(0), phi(0) = 1+CC.(D(phi))(0), (D(f))(etainf) = 0, theta(etainf) = 0, phi(etainf) = 0

Error, (in dsolve/numeric/ComputeSolution) Newton iteration is not converging

how to translate python code which use scipy, numpy to maple code

 

 

import numpy as np
from scipy.sparse.linalg import svds
from functools import partial


def emsvd(Y, k=None, tol=1E-3, maxiter=None):
    """
    Approximate SVD on data with missing values via expectation-maximization

    Inputs:
    -----------
    Y:          (nobs, ndim) data matrix, missing values denoted by NaN/Inf
    k:          number of singular values/vectors to find (default: k=ndim)
    tol:        convergence tolerance on change in trace norm
    maxiter:    maximum number of EM steps to perform (default: no limit)

    Returns:
    -----------
    Y_hat:      (nobs, ndim) reconstructed data matrix
    mu_hat:     (ndim,) estimated column means for reconstructed data
    U, s, Vt:   singular values and vectors (see np.linalg.svd and 
                scipy.sparse.linalg.svds for details)
    """

    if k is None:
        svdmethod = partial(np.linalg.svd, full_matrices=False)
    else:
        svdmethod = partial(svds, k=k)
    if maxiter is None:
        maxiter = np.inf

    # initialize the missing values to their respective column means
    mu_hat = np.nanmean(Y, axis=0, keepdims=1)
    valid = np.isfinite(Y)
    Y_hat = np.where(valid, Y, mu_hat)

    halt = False
    ii = 1
    v_prev = 0

    while not halt:

        # SVD on filled-in data
        U, s, Vt = svdmethod(Y_hat - mu_hat)

        # impute missing values
        Y_hat[~valid] = (U.dot(np.diag(s)).dot(Vt) + mu_hat)[~valid]

        # update bias parameter
        mu_hat = Y_hat.mean(axis=0, keepdims=1)

        # test convergence using relative change in trace norm
        v = s.sum()
        if ii >= maxiter or ((v - v_prev) / v_prev) < tol:
            halt = True
        ii += 1
        v_prev = v

    return Y_hat, mu_hat, U, s, Vt

Hi,

I did some hypothesis testing exercises and I cross checked the result with Maple. I just used following vectors for an unpaired test

a := [88, 89, 92, 90, 90];
b := [92, 90, 91, 89, 91];

I ended up with the following solution:

HFloat(1.5225682336585966)
HFloat(-3.122568233658591)
for a 0.95 confidence interval.

 

Using

TwoSampleTTest(a, b, 0, confidence = .95, summarize = embed)

and

TwoSampleTTest(a, b, 0, confidence = .975, summarize = embed)

I get following results:

-2.75177 .. 1.15177

-3.13633 .. 1.53633

respectively. I can not explain the discrepancy.

 

Best regards,

Oliver

 

PS:

Maple Code in case files won´t be attached.

 

 

Unpaired t Test
restart;
Unpaired test-test dataset
a := [88, 89, 92, 90, 90];
b := [92, 90, 91, 89, 91];
The se² estimate is given by:
se²=var(a)+var(b)+2*cov(a*b)=var(a)+var(b)
se²=
sigma[a]^2/Na+sigma[b]^2/Nb;
with Na, Nb being the length of vector a and b respectively.
                             2                              2
  sigma[[88, 89, 92, 90, 90]]    sigma[[92, 90, 91, 89, 91]]
  ---------------------------- + ----------------------------
               Na                             Nb             
sigma[a]^2;
 and
sigma[b]^2;
 are approximated by
S[a]^2;
 and
S[b]^2;
                                             2
                  sigma[[88, 89, 92, 90, 90]]
                                             2
                  sigma[[92, 90, 91, 89, 91]]
                                           2
                    S[[88, 89, 92, 90, 90]]
                                           2
                    S[[92, 90, 91, 89, 91]]
with
S[X]^2;
 defined as
S[X]*`²` = (sum(X[i]-(sum(X[j], j = 1 .. N))/N, i = 1 .. N))^2/N;
                                 2
                             S[X]
                                                 2
                      /      /         N       \\
                      |      |       -----     ||
                      |  N   |        \        ||
                      |----- |         )       ||
                      | \    |        /    X[j]||
                      |  )   |       -----     ||
                      | /    |       j = 1     ||
                      |----- |X[i] - ----------||
                      \i = 1 \           N     //
             S[X] ᅡᄇ = ----------------------------
                                   N              
with(Statistics);
Sa := Variance(a);
                   HFloat(2.1999999999999993)
Sb := Variance(b);
                   HFloat(1.3000000000000003)
Now we are ready to do hypothesis testing (0.95).
We have (with k=min(Na,Nb)=5):
C = mean(a)-mean(b); Deviation := t_(alpha/a, k-1)*se(Sa/k-Sb/k);
c := Mean(a)-Mean(b); deviation := 2.776*sqrt((1/5)*Variance(a)+(1/5)*Variance(b));
                  HFloat(-0.7999999999999972)
                   HFloat(2.3225682336585938)
upperlimit := c+deviation; lowerlimit := c-deviation;
                   HFloat(1.5225682336585966)
                   HFloat(-3.122568233658591)

Execution of built in student test
TwoSampleTTest(a, b, 0, confidence = .95, summarize = embed);

 

 

I am unable to solve the attached optimal control problem,please any one who many help  me in guideing .tnx

restart:
unprotect('gamma');

L:=b[1]*c(t)+b[2]*i(t)+w[1]*(u[1])^2/2+w[2]*(u[2])^2/2+w[3]*(u[3])^2/2;
1 2 1 2 1 2
b[1] c(t) + b[2] i(t) + - w[1] u[1] + - w[2] u[2] + - w[3] u[3]
2 2 2
H:=L+lambda[1](t)*((1-p*Psi)*tau+phi* v + delta *r-lambda*(1-u[3])*s-u[1]*varphi*s -mu*s ) +lambda[2](t)*(p*Psi*tau + u[1]*vartheta*s -gamma*lambda* (1-u[3])*v-(mu+phi)*v ) +lambda[3](t)*( (1-u[3])*rho*lambda* (s +gamma*v)+(1-q)* u[2]*eta*i -(mu +beta +chi)*c ) +lambda[4](t)* ((1-rho)*(1-u[3])*lambda*( s +gamma*v) +chi*c - u[2]*eta*i - (mu +alpha )*i) +lambda[5](t)*( beta*c + u[2]*q*eta*i -(mu +delta)*r);
1 2 1 2 1 2
b[1] c(t) + b[2] i(t) + - w[1] u[1] + - w[2] u[2] + - w[3] u[3] + lambda[1](t
2 2 2

) ((1 - p Psi) tau + phi v + delta r - lambda (1 - u[3]) s - u[1] varphi s

- mu s) + lambda[2](t) (p Psi tau + u[1] vartheta s

- gamma lambda (1 - u[3]) v - (mu + phi) v) + lambda[3](t) ((1 - u[3]) rho

lambda (s + gamma v) + (1 - q) u[2] eta i - (mu + beta + chi) c) + lambda[4](t

) ((1 - rho) (1 - u[3]) lambda (s + gamma v) + chi c - u[2] eta i

- (mu + alpha) i) + lambda[5](t) (beta c + u[2] q eta i - (mu + delta) r)
du1:=diff(H,u[1]);

w[1] u[1] - lambda[1](t) varphi s + lambda[2](t) vartheta s
du2:=diff(H,u[2]);du3:=diff(H,u[3]);
w[2] u[2] + lambda[3](t) (1 - q) eta i - lambda[4](t) eta i

+ lambda[5](t) q eta i
w[3] u[3] + lambda[1](t) lambda s + lambda[2](t) gamma lambda v

- lambda[3](t) rho lambda (s + gamma v)

- lambda[4](t) (1 - rho) lambda (s + gamma v)

ddu1 := -A[1] u[1] + psi[1](t) beta x[1] x[3] - psi[2](t) beta x[1] x[3]

ddu2 := -A[2] u[2] - psi[3](t) k x[2]
sol_u1 := solve(du1, u[1]);
s(t) (lambda[1](t) varphi - lambda[2](t) vartheta)
--------------------------------------------------
w[1]
sol_u2 := solve(du2, u[2]);sol_u3 := solve(du3, u[3]);
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q)
----------------------------------------------------------------------
w[2]
1
---- (lambda (-lambda[1](t) s - lambda[2](t) gamma v + lambda[3](t) rho s
w[3]

+ lambda[3](t) rho gamma v + lambda[4](t) s + lambda[4](t) gamma v

- lambda[4](t) rho s - lambda[4](t) rho gamma v))
Dx2:=subs(u[1]= s*(lambda[1](t)*varphi-lambda[2](t)*vartheta)/w[1] ,u[2]= eta*i*(-lambda[3](t)+lambda[3](t)*q+lambda[4](t)-lambda[5](t)*q)/w[2], u[3]=-lambda*(lambda[1](t)*s+lambda[2](t)*gamma*v-lambda[3](t)*rho*s-lambda[3](t)*rho*gamma*v-lambda[4](t)*s-lambda[4](t)*gamma*v+lambda[4](t)*rho*s+lambda[4](t)*rho*gamma*v)/w[3] ,H );
2 2
s (lambda[1](t) varphi - lambda[2](t) vartheta)
b[1] c(t) + b[2] i(t) + -------------------------------------------------
2 w[1]

2 2 2
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q)
+ ------------------------------------------------------------------------- +
2 w[2]

1 / 2
------ \lambda (lambda[1](t) s + lambda[2](t) gamma v - lambda[3](t) rho s
2 w[3]

- lambda[3](t) rho gamma v - lambda[4](t) s - lambda[4](t) gamma v

/
\ |
+ lambda[4](t) rho s + lambda[4](t) rho gamma v)^2/ + lambda[1](t) |(1
\

/ 1
- p Psi) tau + phi v + delta r - lambda |1 + ---- (lambda (lambda[1](t) s
\ w[3]

+ lambda[2](t) gamma v - lambda[3](t) rho s - lambda[3](t) rho gamma v

- lambda[4](t) s - lambda[4](t) gamma v + lambda[4](t) rho s

\
+ lambda[4](t) rho gamma v))| s
/

2 \
s (lambda[1](t) varphi - lambda[2](t) vartheta) varphi |
- ------------------------------------------------------- - mu s| +
w[1] /

/
|
lambda[2](t) |p Psi tau
\

2
s (lambda[1](t) varphi - lambda[2](t) vartheta) vartheta /
+ --------------------------------------------------------- - gamma lambda |1 +
w[1] \

1
---- (lambda (lambda[1](t) s + lambda[2](t) gamma v - lambda[3](t) rho s
w[3]

- lambda[3](t) rho gamma v - lambda[4](t) s - lambda[4](t) gamma v

\
\ |
+ lambda[4](t) rho s + lambda[4](t) rho gamma v))| v - (mu + phi) v| +
/ /

// 1
lambda[3](t) ||1 + ---- (lambda (lambda[1](t) s + lambda[2](t) gamma v
\\ w[3]

- lambda[3](t) rho s - lambda[3](t) rho gamma v - lambda[4](t) s

\
- lambda[4](t) gamma v + lambda[4](t) rho s + lambda[4](t) rho gamma v))|
/

1 / 2 2
rho lambda (s + gamma v) + ---- \(1 - q) eta i (-lambda[3](t)
w[2]

\ \
+ lambda[3](t) q + lambda[4](t) - lambda[5](t) q)/ - (mu + beta + chi) c| +
/

/
| / 1
lambda[4](t) |(1 - rho) |1 + ---- (lambda (lambda[1](t) s
\ \ w[3]

+ lambda[2](t) gamma v - lambda[3](t) rho s - lambda[3](t) rho gamma v

- lambda[4](t) s - lambda[4](t) gamma v + lambda[4](t) rho s

\
+ lambda[4](t) rho gamma v))| lambda (s + gamma v) + chi c
/

2 2
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q)
- ------------------------------------------------------------------------
w[2]

\ /
| |
- (mu + alpha) i| + lambda[5](t) |beta c
/ \

+

2 2
eta i (-lambda[3](t) + lambda[3](t) q + lambda[4](t) - lambda[5](t) q) q
--------------------------------------------------------------------------
w[2]

\
|
- (mu + delta) r|
/
ode1:=diff(lambda[1](t),t)=-diff(H,s);ode2:=diff(lambda[2](t),t)=-diff(H,v);ode3:=diff(psi[3](t),t)=-diff(H,c);ode4:=diff(lambda[4](t),t)=-diff(H,i);ode5:=diff(lambda[5](t),t)=-diff(H,r);
d
--- lambda[1](t) = -lambda[1](t) (-lambda (1 - u[3]) - u[1] varphi - mu)
dt

- lambda[2](t) u[1] vartheta - lambda[3](t) (1 - u[3]) rho lambda

- lambda[4](t) (1 - rho) (1 - u[3]) lambda
d
--- lambda[2](t) = -lambda[1](t) phi
dt

- lambda[2](t) (-gamma lambda (1 - u[3]) - mu - phi)

- lambda[3](t) (1 - u[3]) rho lambda gamma

- lambda[4](t) (1 - rho) (1 - u[3]) lambda gamma
d
--- psi[3](t) = -lambda[3](t) (-mu - beta - chi) - lambda[4](t) chi
dt

- lambda[5](t) beta
d
--- lambda[4](t) = -lambda[3](t) (1 - q) u[2] eta
dt

- lambda[4](t) (-u[2] eta - mu - alpha) - lambda[5](t) u[2] q eta
d
--- lambda[5](t) = -lambda[1](t) delta - lambda[5](t) (-mu - delta)
dt
restart:
#Digits:=10:


unprotect('gamma');
lambda:=0.51:
mu:=0.002:
beta:=0.0115:
delta:=0.003:
alpha:=0.33:
chi:=0.00274:
k:=6.24:
gamma:=0.4:
rho:=0.338:;tau=1000:;Psi:=0.1:;p:=0.6:;phi:=0.001:;eta:=0.001124:q:=0.6:varphi:=0.9:;vatheta:=0.9:
b[1]:=2:;b[2]:=3:;w[1]:=4:;w[2]:=5:;w[3]:=6:
#u[1]:=s(t)*(lambda[1](t)*varphi-lambda[2](t)*vartheta)/w[1]:
#u[2]:=eta*i*(-lambda[3](t)+lambda[3](t)*q+lambda[4](t)-lambda[5](t)*q)/w[2]:;u[3]:=lambda*(-lambda[1](t)*s-lambda[2](t)*gamma*v+lambda[3](t)*rho*s+lambda[3](t)*rho*gamma*v+lambda[4](t)*s+lambda[4](t)*gamma*v-lambda[4](t)*rho*s-lambda[4](t)*rho*gamma*v)/w[3]:
ics := s(0)=8200, v(0)=2800,c(0)=1100,i(0)=1500,r(0)=200,lambda[1](20)=0,lambda[2](20)=0,lambda[3](20)=0,lambda[4](20)=0,lambda[5](20)=0:
ode1:=diff(s(t),t)=(1-p*Psi)*tau+phi* v(t) + delta *r(t)-lambda*(1-u[3])*s(t)-u[1]*varphi*s(t) -mu*s(t),
diff(v(t), t) =p*Psi*tau + u[1]*vartheta*s(t) -gamma*lambda* (1-u[3])*v(t)-(mu+phi)*v(t) ,
diff(c(t), t) =(1-u[3])*rho*lambda* (s(t) +gamma*v(t))+(1-q)* u[2]*eta*i(t) -(mu +beta +chi)*c(t),
diff(i(t), t) =(1-rho)*(1-u[3])*lambda*( s(t) +gamma*v(t)) +chi*c(t) - u[2]*eta*i(t) - (mu +alpha )*i(t),
diff(r(t), t) = beta*c(t) + u[2]*q*eta*i(t) -(mu +delta)*r(t),
diff(lambda[1](t), t) = -lambda[1](t)*(-lambda*(1-u[3])-u[1]*varphi-mu)-lambda[2](t)*u[1]*vartheta-lambda[3](t)*(1-u[3])*rho*lambda-lambda[4](t)*(1-rho)*(1-u[3])*lambda,diff(lambda[2](t),t)=-lambda[1](t)*phi-lambda[2](t)*(-gamma*lambda*(1-u[3])-mu-phi)-lambda[3](t)*(1-u[3])*rho*lambda*gamma-lambda[4](t)*(1-rho)*(1-u[3])*lambda*gamma,diff(lambda[3](t),t)=-lambda[3](t)*(-mu-beta-chi)-lambda[4](t)*chi-lambda[5](t)*beta,diff(lambda[4](t),t)=-lambda[3](t)*(1-q)*u[2]*eta-lambda[4](t)*(-u[2]*eta-mu-alpha)-lambda[5](t)*u[2]*q*eta,diff(lambda[5](t),t)=-lambda[1](t)*delta-lambda[5](t)*(-mu-delta);
d
--- s(t) = (1 - p Psi) tau + phi v(t) + delta r(t) - lambda (1 - u[3]) s(t)
dt

d
- u[1] varphi s(t) - mu s(t), --- v(t) = p Psi tau + u[1] vartheta s(t)
dt

d
- gamma lambda (1 - u[3]) v(t) - (mu + phi) v(t), --- c(t) = (1 - u[3]) rho lambda
dt

(s(t) + gamma v(t)) + (1 - q) u[2] eta - (mu + beta + chi) c(t), 0 = (1

- rho) (1 - u[3]) lambda (s(t) + gamma v(t)) + chi c(t) - u[2] eta - mu

d d
- alpha, --- r(t) = beta c(t) + u[2] q eta - (mu + delta) r(t), ---
dt dt

lambda[1](t) = -lambda[1](t) (-lambda (1 - u[3]) - u[1] varphi - mu)

- lambda[2](t) u[1] vartheta - lambda[3](t) (1 - u[3]) rho lambda

d
- lambda[4](t) (1 - rho) (1 - u[3]) lambda, --- lambda[2](t) =
dt
-lambda[1](t) phi - lambda[2](t) (-gamma lambda (1 - u[3]) - mu - phi)

- lambda[3](t) (1 - u[3]) rho lambda gamma

d
- lambda[4](t) (1 - rho) (1 - u[3]) lambda gamma, --- lambda[3](t) =
dt
d
-lambda[3](t) (-mu - beta - chi) - lambda[4](t) chi - lambda[5](t) beta, ---
dt

lambda[4](t) = -lambda[3](t) (1 - q) u[2] eta

- lambda[4](t) (-u[2] eta - mu - alpha) - lambda[5](t) u[2] q eta,

d
--- lambda[5](t) = -lambda[1](t) delta - lambda[5](t) (-mu - delta)
dt

sol := dsolve({c(0) = 0, i(0) = 0, r(0) = .1, s(0) = 0, v(0) = 0, diff(c(t), t) = (1-u[3])*rho*lambda*(s(t)+gamma*v(t))+(1-q)*u[2]*eta*i(t)-(mu+beta+chi)*c(t), diff(i(t), t) = (1-rho)*(1-u[3])*lambda*(s(t)+gamma*v(t))+chi*c(t)-u[2]*eta*i(t)-(mu+alpha)*i(t), diff(r(t), t) = beta*c(t)+u[2]*q*eta*i(t)-(mu+delta)*r(t), diff(s(t), t) = (1-p*Psi)*tau+phi*v(t)+delta*r(t)-lambda*(1-u[3])*s(t)-u[1]*varphi*s(t)-mu*s(t), diff(v(t), t) = p*Psi*tau+u[1]*vartheta*s(t)-gamma*lambda*(1-u[3])*v(t)-(mu+phi)*v(t), diff(lambda[1](t), t) = -lambda[1](t)*(-lambda*(1-u[3])-u[1]*varphi-mu)-lambda[2](t)*u[1]*vartheta-lambda[3](t)*(1-u[3])*rho*lambda-lambda[4](t)*(1-rho)*(1-u[3])*lambda, diff(lambda[2](t), t) = -lambda[1](t)*phi-lambda[2](t)*(-gamma*lambda*(1-u[3])-mu-phi)-lambda[3](t)*(1-u[3])*rho*lambda*gamma-lambda[4](t)*(1-rho)*(1-u[3])*lambda*gamma, diff(lambda[3](t), t) = -lambda[3](t)*(-mu-beta-chi)-lambda[4](t)*chi-lambda[5](t)*beta, diff(lambda[4](t), t) = -lambda[3](t)*(1-q)*u[2]*eta-lambda[4](t)*(-u[2]*eta-mu-alpha)-lambda[5](t)*u[2]*q*eta, diff(lambda[5](t), t) = -lambda[1](t)*delta-lambda[5](t)*(-mu-delta), lambda[1](20) = 0, lambda[2](20) = 0, lambda[3](20) = 0, lambda[4](20) = 0, lambda[5](20) = 0}, type = numeric);
Error, (in dsolve/numeric/process_input) invalid specification of initial conditions, got 1 = 0

sol:=dsolve([ode1,ics],numeric, method = bvp[midrich],maxmesh=500);

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

dsolve[':-interactive']({});
Error, `:=` unexpected
sol:=dsolve([ode1,ics],numeric, method = bvp[midrich],maxmesh=500);
Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

eq1:=diff(s(t), t)=(1-p*Psi)*tau+phi* v(t) + delta *r(t)-lambda*(1-u[3])*s(t)-u[1]*varphi*s(t) -mu*s(t);
eq2:diff(v(t), t) =p*Psi*tau + u[1]*vartheta*s(t) -gamma*lambda* (1-u[3])*v(t)-(mu+phi)*v(t);
eq3:=diff(c(t), t) =(1-u[3])*rho*lambda* (s(t) +gamma*v(t))+(1-q)* u[2]*eta*i(t) -(mu +beta +chi)*c(t);
eq4:=diff(i(t), t) =(1-rho)*(1-u[3])*lambda*( s(t) +gamma*v(t)) +chi*c(t) - u[2]*eta*i(t) - (mu +alpha )*i(t);
eq5:=diff(r(t), t) = beta*c(t) + u[2]*q*eta*i(t) -(mu +delta)*r(t);

d
--- s(t) = (1 - p Psi) tau + phi v(t) + delta r(t) - lambda (1 - u[3]) s(t)
dt

- u[1] varphi s(t) - mu s(t)
d
--- v(t) = p Psi tau + u[1] vartheta s(t) - gamma lambda (1 - u[3]) v(t)
dt

- (mu + phi) v(t)
d
--- c(t) = (1 - u[3]) rho lambda (s(t) + gamma v(t)) + (1 - q) u[2] eta i(t)
dt

- (mu + beta + chi) c(t)
d
--- i(t) = (1 - rho) (1 - u[3]) lambda (s(t) + gamma v(t)) + chi c(t)
dt

- u[2] eta i(t) - (mu + alpha) i(t)
d
--- r(t) = beta c(t) + u[2] q eta i(t) - (mu + delta) r(t)
dt
eq6:=diff(Q(t),t)=b[1]*c(t)+b[2]*i(t)+w[1]*(u[1])^2/2+w[2]*(u[2])^2/2+w[3]*(u[3])^2/2;
d 1 2 1 2 1 2
--- Q(t) = b[1] c(t) + b[2] i(t) + - w[1] u[1] + - w[2] u[2] + - w[3] u[3]
dt 2 2 2
ics:=s(0)=8200, v(0)=2800,c(0)=1100,i(0)=1500,r(0)=200,Q(0)=6700;
s(0) = 8200, v(0) = 2800, c(0) = 1100, i(0) = 1500, r(0) = 200, Q(0) = 6700
sol0:=dsolve({eq1,eq2,eq3,eq4,eq5,eq6,ics},type=numeric,stiff=true,'parameters'=[u[1],u[2],u[3]],abserr=1e-15,relerr=1e-12,maxfun=0,range=0..50):
Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations
with(plots):
Q0:=6700;
6700
obj:=proc(u)
global sol0,Q0;
local ob1;
try
sol0('parameters'=[u[1],u[2],u[3]]):
ob1:=subs(sol0(20.),Q(t)):
catch :
ob1:=0;
end try;
#ob1:=subs(sol0(20.),Q(t));
if ob1>Q0 then Q0:=ob1;print(Q0,u);end;
ob1;
end proc;
proc(u) ... end;
obj([1,1,1]);
0
obj([3,2.5],4);
0
u0:=Vector(3,[0.,0.,0.],datatype=float[8]);
Vector[column](%id = 85973880)

Q0:=0;
Q0 := 0
with(Optimization);
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize, NLPSolve,

QPSolve]
sol2:=NLPSolve(3,obj,initialpoint=u0,method=nonlinearsimplex,maximize,evaluationlimit=100):
sol0('parameters'=[3.18125786060723, 2.36800986932868]);
sol0(parameters = [3.18125786060723, 2.36800986932868])
for i from 1 to 3 do odeplot(sol0,[t,x[i](t)],0..20,thickness=3,axes=boxed);od;
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

Hi,

I am using the solve command to solve an equation of the form "linear over quadratic is equal to a constant" where the constant is assumed to be nonzero. This is easily solved by hand, of course, but I to use the solution in other computations. So I asked maple to solve it for me. But when I check maple's solution (i.e. just plug the two solutions in on the left hand side and simplify) maple does not return the original constant. Can anyone help me understand what is going wrong?

Dear Forum, 

 

I am a new Maple user, and its symbolic prowess is really amazing. So we are trying to interface it with a C library. I want to generate some C code through Maple, and am trying the CodeGeneration package. 

But the default conversion of C(a, b) is b = C language equivalent of expression a.

Now this should be fine for most purposes, but the C library that we are working with, "ACADOToolkit" in this case, requires the equations to be formatted in a certain way. So, I need the following equation in C:

 

f << dot(v) == (u-0.2*v*v)/m

 

Now the LHS part of == is to be hard-coded, but we want to generate the equation on the right using maple. Even if I define an equation as 

eq1:= diff(v(t),t)=(u(t)-0.2*v(t)*v(t))/m(t) and then use C(rhs(eq1)), I get the result in the form of cg = u - 0.2 ...., whereas I want this to be assigned to something else, in this case - "f << dot(v)= ".

 

How can I achieve this ?

 

Thanks 

Chintan Pathak 

Research Scholar, 

University of Washington

 

First 140 141 142 143 144 145 146 Last Page 142 of 2097