Maple 18 Questions and Posts

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

f:=C->sum(x[cat(new,c)],c=1..C);

f(4) # does not give me what i want , which is

x[cat(new,1)]+x[cat(new,2)]+x[cat(new,3)]+x[cat(new,4)];

 

seq(x[cat(new,c)],c=1..4);
convert([%],`+`);

This works. But it's just a simple example to illustrate my problem.

 

Is there a way to fix this 'cat' problem in the procedure 'f'?

 

Thanks,

 

casper

v1:=[seq(tau[lambda,i]^2,i=1..5)];

latex(v1);

 

gives:

[{\tau_{{\lambda,1}}}^{2},{\tau_{{\lambda,2}}}^{2},{\tau_{{\lambda,3}}
}^{2},{\tau_{{\lambda,4}}}^{2},{\tau_{{\lambda,5}}}^{2}]

which produces a non natural output in latex, see below.

I wonder it could be improved in the future release?

'latex' command is really useful when i have large algebric output. But having to change this tiny thing at many places is just very time consuming. I'd really appreciate if this can be fixed in updates or future versions of Maple.

 

Casper

 

Hi all,

I will use the following dummy example.

with function,f

f:=(xid,yid)->sum(x[i],i=1..xid)*sum(y[i],i=1..yid);

 

and a complicated term, myterm


myterm:=(f(3,4)+f(2,2))*f(1,1):
myterm:=expand(myterm);

 

'if' i have some previous knowledge, or know a bit of the term, i can find the structure by doing this


repar:=[f(1,1),f(2,2),f(3,4)];  # Or with more f(xid,yid) terms

tmp:=seq(repar[i]=ff[i],i=1..3);
simplify(myterm,{tmp});          # This is fine, gives me what i want

 

But, can we go further, and more 'obvious'

 

Given the fucntion f, same as before, and the same 'myterm'

can I have this
restart:
iwant:=(f(3,4)+f(2,2))*f(1,1);  # as a result, straightforward

so I dont have to go back to 'repar' and find that the terms exactly are.

 

Thanks,

 

Hi, with a list

l:=[1,1,1,2,3,3,4];

What's the best way to get the index(s) for the values equal to '1'?

Say for x=1, we want

[1,2,3]

for x=2, we want

[4]

ect.

 

Hi say I have the vector V1.

V1:=Vector([a,b,c,d,e,f,g]):

and function myfun.

 

how do i use it as the input to the function my fun, by taking away each element in turn?
myfun(V1[2..]);              # 1st element removed
myfun(V1[[1,3..]]);         # 2nd element removed
myfun(V1[[1,2,4..]]);      # 3rd element removed

and so go

is there a more efficient way?

 

Many thanks,

Addition, subtraction, scalar product, vector, projections and graphs with physics packages and plots. With this you can begin to start the physics course for engineering.

Operaciones_con_Vect.mw   (in spanish)

 

Lenin Araujo Castillo

Physics Pure

Computer Science

Hello everybody,

Since I am geting older, I need to fix the font size form 12 to 14.  I have been tryong to find where to do that permanent change.  But without success.  Could someone help to to resolve this problem.  Thank you in advance for your help.

 

--------------------------------------
Mario Lemelin
Maple 18 Ubuntu 13.10 - 64 bits
Maple 18 Win 7 - 64 bits messagerie : mario.lemelin@cgocable.ca téléphone :  (819) 376-0987

Say I have this list,

tmp:=[[0, 1, 2], [1, 0, 2], [1, 1, 2], [1, 2, 0]];

and the sums of each element (list),

map(x->convert(x,`+`),tmp);

 

How do I quickly pickup the elements, where they sum to 3? Like this:

wanttohave:=[[0, 1, 2], [1, 0, 2],  [1, 2, 0]];

Thanks,

When I try "touch and drag" in Maple documents, the documentation for example, I end up selecting text instead of scrolling. Unfortunately the alternatives for scrolling are a) the scrollbar, b) page-up/down or c) moving the cursor. Each of those alternatives is about 2.5311 orders of magnitude more inconvenient than touch&drag.

Does anybody know if its possible to get Maple (18) to scroll instead of select text when I touch the screen?

 


m 18 cubacuhre integration fail, intergrand unknown

restartprintlevel = 3binomial(7, 2); with(StringTools); FormatTime(%c)with(LinearAlgebra); with(IntegrationTools)with(numapprox); with(OrthogonalSeries); LinearAlgebra:-HermitianTranspose(3-I*7)infolevel[`evalf/int`] := 4; pie = evalf(Pi)n = 1l = 0m = 0n1 = 1l1 = 0m1 = 0alpha = 5.8alpha1 = 4.2R = .5Theta = (1/6)*PiPhi = 3*Pi*(1/4)region := [r = 0 .. infinity, theta = 0 .. Pi, phi = 0 .. 2*Pi]r1 := proc (r, theta, phi, R, Theta, Phi) options operator, arrow; (r^2+R^2-2*r*R*(sin(theta)*sin(Theta)*cos(phi-Phi)+cos(theta)*cos(Theta)))^(1/2) end proc"coef:=(l1,l2,m1,m2)->(-1)^(l1-l2) (((4 *pie *(2 l1+1)!)/((2 l1-2 l2+1)!*(2 l2+1)!))*("
"(binomial(l1+m1,l2+m2)*binomial(l1-m1,l2m2))/(binomial(2* l1,2* l2)))())^(1/(2));NN:=(n,alpha)->((2 alpha)^(n+(1)/(2)))/(((2 n)!)^((1)/(2)));  "

integrand := sum(sum(R^(l1-l2)*SphericalY(l1-l2, m1-m2, Theta, Phi)*coef(l1, l2, m1, m2)*r^(2+l+l2)*SphericalY(l2, m2, theta, phi)*LinearAlgebra:-HermitianTranspose(SphericalY(l, m, theta, phi))*NN(n, alpha)*r^(n-l-1)*exp(-alpha.r)*NN(n1, alpha1)*r1(r, theta, phi, R, Theta, Phi)^(n1-l1-1)*exp(-alpha1*r1(r, theta, phi, R, Theta, Phi))*sin(theta), m2 = -l2 .. l2), l2 = 0 .. l1)

evalf(Int(integrand, region, 'epsilon' = 0.1e-3, 'method = _CubaCuhre'));
``NULL

binomial(7, 3)region4 := [x = 0 .. 10*Pi, y = 0 .. 10*Pi]

integrand4 := (cos(x)+(1/3)*sin(y))^6*(sin(y)-(1/3)*cos(x))^2

evalf(Int(integrand4, region4, 'epsilon' = 0.1e-3, 'method = _CubaCuhre'))

NULL

NULL

 

Download stovrlp2.mw

m 18 cubacuhre integration fail, intergrand unknown

 

 

Hi,

 

I am completely new to Maple (and this kind of software in general).

I am just on my first steps of learning...but I quickly noticed, that if I write Pi and hit enter, I do not get

the well-known greek Pi-symbol. I get an ordinary "p" as the result.

I checked the greek-palette...nearly all items in this palette are ordinary letters.

Does anyone have an idea whats wrong?

BTW: I don`t know if it could have to do with that, but I use a german windows 7 installation.

 

Thank you,

regards,

Kai

Please see the attached worksheet for the error at the end, any idea what happens?

Besides, anyone know how to make plot array with each element has a plot and scatterplot in it?  I made my plot by making table first and then type the cmd individually.

Raw Data

restart

avicel102_aero200 := Matrix(12, 3, {(1, 1) = 50, (1, 2) = 1.6621, (1, 3) = .22, (2, 1) = 100, (2, 2) = 3.33221, (2, 3) = .103, (3, 1) = 150, (3, 2) = 4.95533, (3, 3) = 0.43e-1, (4, 1) = 200, (4, 2) = 5.62147, (4, 3) = 0.37e-1, (5, 1) = 50, (5, 2) = 1.88627, (5, 3) = .207, (6, 1) = 50, (6, 2) = 1.90375, (6, 3) = .199, (7, 1) = 100, (7, 2) = 4.04708, (7, 3) = 0.89e-1, (8, 1) = 100, (8, 2) = 4.20413, (8, 3) = 0.87e-1, (9, 1) = 150, (9, 2) = 5.50509, (9, 3) = 0.41e-1, (10, 1) = 150, (10, 2) = 4.90453, (10, 3) = 0.49e-1, (11, 1) = 200, (11, 2) = 6.22001, (11, 3) = 0.16e-1, (12, 1) = 200, (12, 2) = 6.24435, (12, 3) = 0.23e-1}); avicel102_syloid := Matrix(13, 3, {(1, 1) = 50, (1, 2) = 1.76578, (1, 3) = .235, (2, 1) = 100, (2, 2) = 4.08314, (2, 3) = .128, (3, 1) = 150, (3, 2) = 4.85921, (3, 3) = 0.73e-1, (4, 1) = 200, (4, 2) = 5.66786, (4, 3) = 0.51e-1, (5, 1) = 50, (5, 2) = 2.06221, (5, 3) = .224, (6, 1) = 50, (6, 2) = 2.17294, (6, 3) = .216, (7, 1) = 100, (7, 2) = 4.03728, (7, 3) = .109, (8, 1) = 100, (8, 2) = 3.67978, (8, 3) = .116, (9, 1) = 150, (9, 2) = 5.78427, (9, 3) = 0.6e-1, (10, 1) = 150, (10, 2) = 5.43599, (10, 3) = 0.59e-1, (11, 1) = 200, (11, 2) = 6.26332, (11, 3) = 0.38e-1, (12, 1) = 200, (12, 2) = 6.10814, (12, 3) = 0.39e-1, (13, 1) = 200, (13, 2) = 6.83857, (13, 3) = 0.25e-1}); avicel301_101_aero200 := Matrix(12, 3, {(1, 1) = 50, (1, 2) = 1.106, (1, 3) = .2597543205, (2, 1) = 50, (2, 2) = 1.06, (2, 3) = .2564849561, (3, 1) = 50, (3, 2) = 1.129, (3, 3) = .2552025392, (4, 1) = 100, (4, 2) = 2.865, (4, 3) = .1280363098, (5, 1) = 100, (5, 2) = 2.793, (5, 3) = .127659333, (6, 1) = 100, (6, 2) = 3.088, (6, 3) = .1347147061, (7, 1) = 150, (7, 2) = 4.216, (7, 3) = 0.802489497e-1, (8, 1) = 150, (8, 2) = 4.044, (8, 3) = 0.838493001e-1, (9, 1) = 150, (9, 2) = 4.071, (9, 3) = 0.855901289e-1, (10, 1) = 200, (10, 2) = 4.826, (10, 3) = 0.627298821e-1, (11, 1) = 200, (11, 2) = 4.924, (11, 3) = 0.614759445e-1, (12, 1) = 200, (12, 2) = 4.76, (12, 3) = 0.61001365e-1})

NULL

 

with(LinearAlgebra):

X[1] := Column(avicel102_aero200, 3):

X[2] := Column(avicel102_syloid, 3):

X[3] := Column(avicel301_101_aero200, 3):

S := Array(1 .. 3):

S[1] := ScatterPlot(X[1], Y[1], labels = [Porocity, Tensile*Strength], title = Compactability*of*Avicel102*with*Aerosil200):

with(plots):NULL

 

vSST := Array(1 .. 3):

tpfit := proc (x, y) options operator, arrow; Fit(a*exp(-k*p)+c, x, y, p, output = [leastsquaresfunction, residualsumofsquares, degreesoffreedom]) end proc:SST := proc (y) options operator, arrow; Variance(y)*(NumElems(y)-1) end proc:NULL

for i to 3 do fnTP[i] := tpfit(X[i], Y[i])[1] end do:

for i to 3 do fnPC[i] := Fit(c*p^2+b*p+a, P[i], X[i], p, output = [leastsquaresfunction, residualsumofsquares, degreesoffreedom])[1] end do:

NULL

for i to 3 do vSST[i] := SST(Y[i]) end do:

for i to 3 do pSST[i] := SST(X[i]) end do:

NULL

for i to 3 do vSSR[i] := tpfit(X[i], Y[i])[2] end do:

for i to 3 do Rsquare[i] := 1-vSSR[i]/vSST[i] end do:

NULL

``

s := Array(1 .. 3):

for i to 3 do s[i] := plot(fnTP[i], p = 0 .. .26, legend = typeset(fnTP[i], R^2, "= ", Rsquare[i])) end do

for i to 3 do ps[i] := plot(fnPC[i], p = 0 .. 200, legend = typeset(fnPC[i], R^2, "= ", pRsquare[i])) end do

G := Array(1 .. 3):

G[1] := [S[1], s[1]]:

pG := [[PS[1], ps[1]], [PS[2], ps[2]], [PS[3], ps[3]]]:NULL

NULL

Table 1: Compactability Curve

display(G[1])

 

NULL

display(G[2])

 

NULL

display(G[3])

 

NULL

NULL

NULL

Table 2: Compressibility Curve

display(pG[1])

 

NULL

display(pG[2])

 

NULL

display(pG[3])

 

NULL

``

ff := proc (x) options operator, arrow; unapply(x, p) end proc:

gtp := map(ff, fnTP):

gpc := map(ff, fnPC):

TS1 := proc (pressure) options operator, arrow; (`@`(gtp[1], gpc[1]))(pressure/Unit('MPa'))*Unit('MPa') end proc:

TS2 := proc (pressure) options operator, arrow; (`@`(gtp[2], gpc[2]))(pressure/Unit('MPa'))*Unit('MPa') end proc:

TS3 := proc (pressure) options operator, arrow; (`@`(gtp[3], gpc[2]))(pressure/Unit('MPa'))*Unit('MPa') end proc:

por1 := proc (p) options operator, arrow; gpc[1](p/Unit('MPa')) end proc:

(1)

por1(x*Unit('MPa'))

HFloat(0.36333333333333295)-HFloat(0.0036139999999999957)*x+HFloat(9.666666666666651e-6)*x^2

(2)

por1(x);

HFloat(0.36333333333333295)-HFloat(0.0036139999999999957)*x/Units:-Unit('MPa')+HFloat(9.666666666666651e-6)*x^2/Units:-Unit('MPa')^2

(3)

``

NULL

 

(4)

ts := 2/3*(10*P/(Pi*D^2*(2.84*t/D-.126*t/W+3.15*W/D+0.1e-1))):

Target Weight of Tablet, m__t:

m__t := 700*Unit('mg')

700*Units:-Unit('mg')

(5)

Tablet True Density:NULL

`ρ__true1` := 1.8*Unit('g'/'cm'^3)

1800.0*Units:-Unit(('kg')/('m')^3)

(6)

Width of tablet w;

d := 7.747*Unit('mm')

7.747*Units:-Unit('mm')

(7)

Length of tablet, l:

l := 17.018*Unit('mm')

17.018*Units:-Unit('mm')

(8)

Cup Depth, h:

hh := 1.6764*Unit('mm')

1.6764*Units:-Unit('mm')

(9)

Cup Volume", `v__cup`"

v__cup := 119.789438*Unit('mm'^3)

119.789438*Units:-Unit(('mm')^3)

(10)

Die cross sectional area, v__die:

a__die := 118.9610524*Unit('mm'^2)

118.9610524*Units:-Unit(('mm')^2)

(11)

Equation to solve tablet thickness using tablet dimension and porocity:

Tablet bulk density:

`ρ__bulk` := `ρ__true`*sf

`ρ__true`*sf

(12)

Tablet volume:``

V__tablet := 2*V__cup+A__die*(t-2*H)

2*V__cup+A__die*(t-2*H)

(13)

NULL

Tablet bulk Density:``

`ρ__bulk` := m__tablet/V__tablet

m__tablet/(2*V__cup+A__die*(t-2*H))

(14)

NULL

eq1 := m__tablet/(2*V__cup+A__die*(t-2*H)) = `ρ__true`*sf

m__tablet/(2*V__cup+A__die*(t-2*H)) = `ρ__true`*sf

(15)

Function for thickness:

thickness := unapply(simplify(solve(eq1, t), size), sf, A__die, H, V__cup, `ρ__true`, m__tablet)

proc (sf, A__die, H, V__cup, `ρ__true`, m__tablet) options operator, arrow; (2*sf*(A__die*H-V__cup)*`ρ__true`+m__tablet)/(A__die*sf*`ρ__true`) end proc

(16)

simplify(thickness(1-por[1](100*Unit(MPa)), a__die, hh, v__cup, `ρ__true1`, m__t))

HFloat(0.005719286791216391)*Units:-Unit('m')

(17)

t2 := proc (cc, A__die, H, V__cup, `ρ__true`, m__tablet) options operator, arrow; simplify(thickness(1-cc, A__die, H, V__cup, `ρ__true`, m__tablet)) end proc:

``

``

``

Tablet tensile strength:NULL

eq2 := `σ__t` = ts

`σ__t` = (20/3)*P/(Pi*D^2*(2.84*t/D-.126*t/W+3.15*W/D+0.1e-1))

(18)

Break force of tablet (N)

breakforce := unapply(subs(W = t-2*h, solve(eq2, P)), `σ__t`, D, h, t)

proc (`σ__t`, D, h, t) options operator, arrow; 0.9424777961e-3*`σ__t`*D*(5.*D*(t-2*h)-63.*t*D+1575.*(t-2*h)^2+1420.*t*(t-2*h))/(t-2*h) end proc

(19)

 

kp := simplify(breakforce(TS[1](100*Unit('MPa')), d, hh, 0.5719e-2*Unit('m')))

HFloat(286.99924404612904)*Units:-Unit('N')

(20)

convert(kp, units, kilopond)

HFloat(29.265778226624693)*Units:-Unit('kilopond')

(21)

t2(por[1](100*Unit('MPa')), a__die, hh, v__cup, `ρ__true1`, m__t)

HFloat(0.005719286791216391)*Units:-Unit('m')

(22)

``

hh

1.6764*Units:-Unit('mm')

(23)

simplify(breakforce(TS[1](100*Unit('MPa')), d, hh, t2(por[1](100*Unit('MPa')), a__die, hh, v__cup, `ρ__true1`, m__t)))

HFloat(287.02451456724083)*Units:-Unit('N')

(24)

Encounter problem while chaning variable

 BF:= 
proc (`σ__t`, D, p, A__die, hhh, V__cup, `ρ__true`, m__tablet) options operator, arrow; breakforce(`σ__f`, D, hhh, t2(p, A__die, hhh, V__cup, `ρ__true`, m__tablet)) end proc:

BF(TS1(100*Unit('MPa')), d, por1(100*Unit('MPa')), a__die, hh, v__cup, `ρ__true1`, m__t)

BF(HFloat(3.6712504621161846)*Units:-Unit('MPa'), 7.747*Units:-Unit('mm'), HFloat(0.09859999999999991), 118.9610524*Units:-Unit(('mm')^2), 1.6764*Units:-Unit('mm'), 119.789438*Units:-Unit(('mm')^3), 1420.00*Units:-Unit(('kg')/('m')^3), 667*Units:-Unit('mg'))

(25)

evalf(TS[1](100*Unit(MPa)))

HFloat(3.6712504621161846)*Units:-Unit('MPa')

(26)

plot(breakforce(TS1(x), d, hh, t2(por1(x), a__die, hh, v__cup, `ρ__true1`, m__t)), x = Unit('MPa') .. 200*Unit('MPa'), useunits = true)

Error, (in Units:-Standard:-+) the units `1` and `1/MPa` have incompatible dimensions

 

plot(t2(por1(x), a__die, hh, v__cup, `ρ__true1`, m__t), x = Unit('MPa') .. 200*Unit('MPa'), useunits = true)

Error, (in Units:-Standard:-+) the units `1` and `1/MPa` have incompatible dimensions

 

plot(evalf(por1(xx)), xx = 10 .. 200)

 

but por1 works fine on its own with units

por1(Units:-Standard:-`*`(200, Unit('MPa')))

HFloat(0.02719999999999989)

(27)

plot(evalf(por1(xx)), xx = 10 .. 200);

 

Unloading Units:-Standard

``

``

``

``

``

``

``

``

``

``

``

``

``

``

 

Fitting_worksheet.mw

I also used a lot for for loop in this worksheet, can anyone suggest another way of doing it? And I think I initiated many Array(1..3) that is of no use.  But if I do not initiate and do the following

A[1]:=a : 

A[2]:=b:

A[3]:=c:

A;

output: A

Only if I initiate A:=Array(1..3) and then define the element I can see the complete A array at the end.

 

Please advise as to the proper coding entries needed in the triple integration palette  to transform from the Cartesian placeholders x;y;z to spherical coordinates rho; theta; phi so that the triple integration palette can be used in spherical coordinmates. Dr. Lopez alreadyb has a standalone template which does this but I would like to set a palette option for spherical  calculations.

 

Thanx

First 85 86 87 Page 87 of 87