tomleslie

13876 Reputation

20 Badges

15 years, 163 days

MaplePrimes Activity


These are answers submitted by tomleslie

provided the same questions are asked - see the attached

  restart;
  with(Student[Calculus1]):

  Ellipse := [3*cos(theta), 2*sin(theta)];

[3*cos(theta), 2*sin(theta)]

(1)

 

Why do the answers from evaluating EllALintegral differ from those provided by the ArcLength command?

  ArcLength(Ellipse, theta = 0 .. 2*Pi);
  evalf(%);

12*EllipticE((1/3)*5^(1/2))

 

15.86543959

(2)

  int1:= ArcLength(Ellipse, theta = 0 .. 2*Pi, output = integral);
  evalf(%);

Int((9*sin(theta)^2+4*cos(theta)^2)^(1/2), theta = 0 .. 2*Pi)

 

15.86543959

(3)

  EllALintegral := int(Integrand(int1)[], theta = 0 .. 2*Pi);
  evalf(%);

12*EllipticE((1/3)*5^(1/2))

 

15.86543959

(4)

 

Download intProb.mw

 

to use the evalc(expr) command. This makes the basic assumption that all variables in the supplied expression are real (probably true in your case), and then does it's best to produce an output of the form a+I*b, Sometimes further dimplification may be desirable (depending on the precise form in which you want the answer. See the attached

  restart;
  expr := (8*x+3*I)/(5*x-I);
  evalc(%);
  simplify(%)

(8*x+3*I)/(5*x-I)

 

40*x^2/(25*x^2+1)-3/(25*x^2+1)+(23*I)*x/(25*x^2+1)

 

((23*I)*x+40*x^2-3)/(25*x^2+1)

(1)

 

Download cmplx.mw

 

You have

kernelopts(includepath="C:\\Home\\Maple projects\\Test_package"):
read("C:\\Home\\Maple projects\\Test_package\\main.mpl");
LibraryTools:-Create("C:\\Home\\Maple projects\\Test_package\\test.mla");
savelib('testSavelib'," C:\\Home\\Maple projects\\CAD project\\test.mla ");

The Create() command is creating a library in one location (",,,,,Test_package\\test.mla")  and the savelib() command is trying to save expressions to a library somewhere else (.... CAD project\\test.mla ") Shouldn't these locations be the same????? Either

kernelopts(includepath="C:\\Home\\Maple projects\\Test_package"):
read("C:\\Home\\Maple projects\\Test_package\\main.mpl");
LibraryTools:-Create("C:\\Home\\Maple projects\\Test_package\\test.mla");
savelib('testSavelib',"C:\\Home\\Maple projects\\Test_package\\test.mla");

or (if the directory "" C:\\Home\\Maple projects\\CAD project" exists), one could use

kernelopts(includepath="C:\\Home\\Maple projects\\Test_package"):
read("C:\\Home\\Maple projects\\Test_package\\main.mpl");
LibraryTools:-Create("C:\\Home\\Maple projects\\CAD project\\test.mla");
savelib('testSavelib',"C:\\Home\\Maple projects\\CAD project\\test.mla");

If you use the latter, you may have to ensure that the directory "....CAD_Project" is in your" include path".

I also notice that in your original code you have extra whitespace inside the strings defining the path name which I have highlighted above . Don't do this, particularly leading or trailing spaces. Notice that the error message you are receiving also contains an (extra?) space - highlighted below

Error, could not open ` C:\Home\Maple projects\CAD project\test.mla \testSavelib.m` for writing

The paths specified by

"C:\Home\Maple projects\CAD project\test.mla " and
"C:\Home\Maple projects\CAD project\test.mla"

are (almost certainly?) two different locations!

in using HPM or HAM (or indeed any other "clever" solution method).

For the system decribed in you pdf  Problem_1.pdf here, a solution can be obtained using Maple's "standard" numerical solvers, as shown in the attached. The only thing you might want to check is the the ODE's use parameters 'Pm' and 'Ph', whereas in your parameter list, you appear to have two occurrences of 'Ph', with two different values.

As a general rule don't complicate things if you don't have to!

  restart;
  odeSys:= [ (1+c__1)*diff(f(t),t$4)-c__1*diff(g(t),t$2)-Rey*(f(t)*diff(f(t),t$3)-diff(f(t),t)*diff(f(t),t$2))-n__0*(1+c__1)*diff(f(t), t$2)-m__0*diff(f(t),t$2),
             c__2*diff(g(t),t$2)+c__1*(diff(f(t),t$2)-2*g(t))-c__3*Rey*(f(t)*diff(g(t),t)-diff(f(t),t)*g(t))=0,
             diff(a(t),t$2)+D__0*diff(b(t),t$2)+Ph*(diff(f(t),t)*a(t)-f(t)*diff(a(t),t))=0,
             diff(b(t), t$2)+S*diff(a(t),t$2)+Pm*(diff(f(t),t)*b(t)-f(t)*diff(b(t),t))=0
           ]:

  bcs:= [ f(-1)=-1, D(f)(-1)=0, g(-1)=0, a(-1)=1, b(-1)=1,
          f(1)=1, D(f)(1)=0, g(1)=0, a(1)=0, b(1)=0
        ]:

  params:=[ c__1=0.1, c__2=0.1, c__3=0.1, Rey=5, n__0=3, m__0=2,
            D__0=0.03, S=2, Ph=0.5, Pm=0.8 # check this
          ]:

  sol:= dsolve
        ( eval
          ( [ odeSys[], bcs[] ],
            params
          ),
          numeric
        ):
  plots:-odeplot
         ( sol,
           [ [t, f(t)],
             [t, g(t)],
             [t, a(t)],
             [t, b(t)]
           ],
           t=-1..1,
           color=[red, blue, cyan, green],
           legend=[ "f(t)", "g(t)", "a(t)", "b(t)"]
         );

 

 

 

Download odeProb.mw

what what your problem is, or what you were trying to achieve. Maybe you want output in the form shown in the attached?

 

 

with(GraphTheory):
with(LinearAlgebra):
GT:= GraphTheory: LT:= ListTools:
TG:= convert~(LT:-Classify(
    sort(DegreeSequence,`>`),
    [GT:-NonIsomorphicGraphs](
        7,6,
        output= graphs,
        outputform= graph,
        restrictto= connected
    )
),list);

table( [( [3, 2, 1, 1, 2, 2, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4}, (2) = {1, 5}, (3) = {1}, (4) = {1}, (5) = {2, 6}, (6) = {5, 7}, (7) = {6}}), `GRAPHLN/table/24`, 0)], ( [3, 2, 2, 1, 2, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4}, (2) = {1, 5}, (3) = {1, 6}, (4) = {1}, (5) = {2, 7}, (6) = {3}, (7) = {5}}), `GRAPHLN/table/26`, 0)], ( [3, 3, 2, 1, 1, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4}, (2) = {1, 5, 6}, (3) = {1, 7}, (4) = {1}, (5) = {2}, (6) = {2}, (7) = {3}}), `GRAPHLN/table/28`, 0)], ( [4, 2, 2, 1, 1, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4, 5}, (2) = {1, 6}, (3) = {1, 7}, (4) = {1}, (5) = {1}, (6) = {2}, (7) = {3}}), `GRAPHLN/table/30`, 0)], ( [2, 2, 2, 2, 2, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3}, (2) = {1, 4}, (3) = {1, 5}, (4) = {2, 6}, (5) = {3, 7}, (6) = {4}, (7) = {5}}), `GRAPHLN/table/23`, 0)], ( [4, 3, 1, 1, 1, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4, 5}, (2) = {1, 6, 7}, (3) = {1}, (4) = {1}, (5) = {1}, (6) = {2}, (7) = {2}}), `GRAPHLN/table/31`, 0)], ( [3, 2, 1, 1, 3, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4}, (2) = {1, 5}, (3) = {1}, (4) = {1}, (5) = {2, 6, 7}, (6) = {5}, (7) = {5}}), `GRAPHLN/table/25`, 0)], ( [4, 2, 1, 1, 1, 2, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4, 5}, (2) = {1, 6}, (3) = {1}, (4) = {1}, (5) = {1}, (6) = {2, 7}, (7) = {6}}), `GRAPHLN/table/29`, 0)], ( [6, 1, 1, 1, 1, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4, 5, 6, 7}, (2) = {1}, (3) = {1}, (4) = {1}, (5) = {1}, (6) = {1}, (7) = {1}}), `GRAPHLN/table/33`, 0)], ( [3, 2, 2, 2, 1, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4}, (2) = {1, 5}, (3) = {1, 6}, (4) = {1, 7}, (5) = {2}, (6) = {3}, (7) = {4}}), `GRAPHLN/table/27`, 0)], ( [5, 2, 1, 1, 1, 1, 1] ) = [GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2, 3, 4, 5, 6}, (2) = {1, 7}, (3) = {1}, (4) = {1}, (5) = {1}, (6) = {1}, (7) = {2}}), `GRAPHLN/table/32`, 0)] ] )

(1)

s:=[indices(TG, 'nolist')];# It's weird here!!

 

[[3, 2, 1, 1, 2, 2, 1], [3, 2, 2, 1, 2, 1, 1], [3, 3, 2, 1, 1, 1, 1], [4, 2, 2, 1, 1, 1, 1], [2, 2, 2, 2, 2, 1, 1], [4, 3, 1, 1, 1, 1, 1], [3, 2, 1, 1, 3, 1, 1], [4, 2, 1, 1, 1, 2, 1], [6, 1, 1, 1, 1, 1, 1], [3, 2, 2, 2, 1, 1, 1], [5, 2, 1, 1, 1, 1, 1]]

(2)

 

whattype(s)

list

(3)

t := table([green = gruen, red = rot, blue = blau, black = schwarz]);
s:=[indices(t, 'nolist')];
nops([s])

table( [( green ) = gruen, ( red ) = rot, ( blue ) = blau, ( black ) = schwarz ] )

 

[green, red, blue, black]

 

1

(4)

 

Download indNoList.mw

 

 

Maple, pdf, and MAC seems to be a "bad combinaton". There is a whole FAQ on this issue at

https://faq.maplesoft.com/s/article/Why-can-I-not-Print-to-PDF-on-my-Mac?language=en_US

Have you read this?

Since I'm using windows, I don't think I can help much.  I use ->ExportAs and select PDF, which *seems* to work, except that it ialways uses "US letter size" (ie 8.5in by 11in) and I have never figured out how to set the default to A4 (ie 210mm by 297mm)

Maple 2022

Which I jyst installed yesterday.

Physics:-Version(); returns

The Physics Updates package is not installed

I then enter

Physics:-Version(latest);

and after a few seconds, I get a polite message to restart Maple. After doing so

Physics:-Version(); returns

`The "Physics Updates" version in the MapleCloud is 1183 and is the same as the version installed in this computer, created 2022, March 18, 12:46 hours Pacific Time.

Maple 2021

Physics:-Version(); returns

`The "Physics Updates" version in the MapleCloud is 1183. The version installed in this computer is 1127 created 2022, January 3, 14:33 hours Pacific Time, found in the directory C:\\Users\\TomLeslie\\maple\\toolbox\\2021\\Physics Updates\\lib\\`

Now enter

Physics:-Version(latest); which returns

Error, (in Physics:-Version) this package is intended to work with Maple 2022; it can not be installed in the version you are using -- 2021

Rather than use Physics:-Version(latest), if I try this from the  MapleCloud, I get an installation pop-up window which errors about half way through. From the package documentation, it appear that version 1181 is the latest version which works in  Maple 2021. So entering

Physics:-Version(1181) returns

Warning, In order to have the version of the Physics Updates just installed active, please close Maple entirely, then open Maple and input Physics:-Version() to confirm you have the version you requested.

So closing Maple 2021 and reopening

Physics:-Version() now returns

`The "Physics Updates" version in the MapleCloud is 1183. The version installed in this computer is 1181 created 2022, March 16, 17:49 hours Pacific Time, found in the directory C:\\Users\\TomLeslie\\maple\\toolbox\\2021\\Physics Updates\\lib\\`

So Update 1181 has been installed - although this message *suggests* that one could update to 1183, although as noted earlier 1183 won't run in Maple 2021

Conclusions

The latest version of Physics updates which can be installed in Maple 2021 is 1181, and this is probably best done by enering

Physics:-Update(1181)

at the command prompt in Maple 2021

The latest version of Physics updates which can be installed in Maple 2022 is 1183, and this is probably best done by enering

Physics:-Update(latest)

at the command prompt in Maple 2022. For Maple 2022, using Physics:-Update(1183) also ought to work - but having already installed this version using 'latest', no convenient way I can check

 

fsolve() in general would only return a single root for functions which are not simple polynomials. It is possible to ose fsolve() with the 'avoid' option to try and generate further roots.Not saying this can't be done, but I tried this but didn't get too far.

However with the (free) DirectSearch add-on package for Maple available from the Maple Application centre, a one-line simple  command came up with 42 roots. Not sure if that is all of them - maybe because I alaway suspicious of results from what is essentially an optimiser

See the attached.

  restart:
  with(RootFinding):
  a[1]:= .1093: k[3]:= 7.5*10^(-12): k[2]:= 3.8*10^(-12):
  d:= 0.2e-3: eta[1]:= 0.240e-1: alpha[2]:= -.1104:
  alpha[3]:= -0.1104e-2: eta[2]:= .1361: xi:= 1.219*10^(-6):
  alpha:= 1-alpha[3]^2/(a[1]*eta[1]): theta[0]:= 0.5e-1:
  Hc:= (Pi/d)*sqrt(k[2]/xi):

  H:= 5.5*Hc:
  lambda:= a[1]/(xi*H^2):
  f:= unapply((H/Hc)^2-4*q^2*(tan(q)-q/(1-alpha))/(Pi^2*(tan(q)-q)),q);

proc (q) options operator, arrow; 30.24999998-4*q^2*(tan(q)-2152.252494*q)/(Pi^2*(tan(q)-q)) end proc

(1)

  interface(rtablesize=50):
  ans:=DirectSearch:-SolveEquations(f,AllSolutions=true);
#
# Extract the actual roots and sort them
#
  ansSort:=sort(entries~(ans[..,3], 'nolist'));
  interface(rtablesize=10):

Matrix(47, 4, {(1, 1) = 0.1609764636e-15, (1, 2) = Vector(1, {(1) = 0.1268765004e-7}), (1, 3) = Vector(1, {(1) = -1.5794237664}), (1, 4) = 21, (2, 1) = 0.1590985127e-14, (2, 2) = Vector(1, {(1) = -0.3988715491e-7}), (2, 3) = Vector(1, {(1) = 1.5794237664}), (2, 4) = 42, (3, 1) = 0.1360469941e-11, (3, 2) = Vector(1, {(1) = -0.11664e-5}), (3, 3) = Vector(1, {(1) = 42.4114903226}), (3, 4) = 59, (4, 1) = 0.1757286539e-11, (4, 2) = Vector(1, {(1) = 0.13256e-5}), (4, 3) = Vector(1, {(1) = -89.5353854863}), (4, 4) = 67, (5, 1) = 0.8651284813e-11, (5, 2) = Vector(1, {(1) = -0.29413e-5}), (5, 3) = Vector(1, {(1) = 17.2787394247}), (5, 4) = 47, (6, 1) = 0.1688036992e-10, (6, 2) = Vector(1, {(1) = 0.41086e-5}), (6, 3) = Vector(1, {(1) = -86.3937926494}), (6, 4) = 55, (7, 1) = 0.5109618415e-10, (7, 2) = Vector(1, {(1) = 0.71482e-5}), (7, 3) = Vector(1, {(1) = 80.1106069341}), (7, 4) = 70, (8, 1) = 0.5109618415e-10, (8, 2) = Vector(1, {(1) = 0.71482e-5}), (8, 3) = Vector(1, {(1) = -80.1106069341}), (8, 4) = 69, (9, 1) = 0.6767702417e-10, (9, 2) = Vector(1, {(1) = 0.82266e-5}), (9, 3) = Vector(1, {(1) = -73.8274211520}), (9, 4) = 69, (10, 1) = 0.1035917565e-9, (10, 2) = Vector(1, {(1) = 0.101780e-4}), (10, 3) = Vector(1, {(1) = 29.8451159450}), (10, 4) = 47, (11, 1) = 0.1038611085e-9, (11, 2) = Vector(1, {(1) = 0.101912e-4}), (11, 3) = Vector(1, {(1) = -4.7126220995}), (11, 4) = 27, (12, 1) = 0.1072475664e-9, (12, 2) = Vector(1, {(1) = 0.103560e-4}), (12, 3) = Vector(1, {(1) = 26.7035219764}), (12, 4) = 51, (13, 1) = 0.3458136494e-9, (13, 2) = Vector(1, {(1) = 0.185961e-4}), (13, 3) = Vector(1, {(1) = -36.1283033908}), (13, 4) = 48, (14, 1) = 0.3584630775e-9, (14, 2) = Vector(1, {(1) = 0.189331e-4}), (14, 3) = Vector(1, {(1) = -17.2787394247}), (14, 4) = 40, (15, 1) = 0.3658928321e-9, (15, 2) = Vector(1, {(1) = 0.191283e-4}), (15, 3) = Vector(1, {(1) = 89.5353854863}), (15, 4) = 56, (16, 1) = 0.6622298869e-9, (16, 2) = Vector(1, {(1) = -0.257338e-4}), (16, 3) = Vector(1, {(1) = -64.4026423139}), (16, 4) = 66, (17, 1) = 0.6703036941e-9, (17, 2) = Vector(1, {(1) = 0.258902e-4}), (17, 3) = Vector(1, {(1) = -23.5619278325}), (17, 4) = 46, (18, 1) = 0.6900373055e-9, (18, 2) = Vector(1, {(1) = -0.262686e-4}), (18, 3) = Vector(1, {(1) = -32.9867097431}), (18, 4) = 52, (19, 1) = 0.7288453593e-9, (19, 2) = Vector(1, {(1) = 0.269971e-4}), (19, 3) = Vector(1, {(1) = 4.7126220993}), (19, 4) = 27, (20, 1) = 0.7667552900e-9, (20, 2) = Vector(1, {(1) = 0.276903e-4}), (20, 3) = Vector(1, {(1) = -7.8539940639}), (20, 4) = 32, (21, 1) = 0.7701963329e-9, (21, 2) = Vector(1, {(1) = -0.277524e-4}), (21, 3) = Vector(1, {(1) = 76.9690140524}), (21, 4) = 71, (22, 1) = 0.1018828140e-8, (22, 2) = Vector(1, {(1) = -0.319191e-4}), (22, 3) = Vector(1, {(1) = 7.8539940641}), (22, 4) = 43, (23, 1) = 0.1054823577e-8, (23, 2) = Vector(1, {(1) = -0.324780e-4}), (23, 3) = Vector(1, {(1) = -45.5530836440}), (23, 4) = 66, (24, 1) = 0.1086951117e-8, (24, 2) = Vector(1, {(1) = -0.329689e-4}), (24, 3) = Vector(1, {(1) = 54.9778631952}), (24, 4) = 60, (25, 1) = 0.1789054721e-8, (25, 2) = Vector(1, {(1) = -0.422972e-4}), (25, 3) = Vector(1, {(1) = 64.4026423139}), (25, 4) = 56, (26, 1) = 0.2414497685e-8, (26, 2) = Vector(1, {(1) = 0.491375e-4}), (26, 3) = Vector(1, {(1) = 51.8362700697}), (26, 4) = 64, (27, 1) = 0.2793647501e-8, (27, 2) = Vector(1, {(1) = 0.528550e-4}), (27, 3) = Vector(1, {(1) = 58.1194562736}), (27, 4) = 52, (28, 1) = 0.3021817696e-8, (28, 2) = Vector(1, {(1) = -0.549711e-4}), (28, 3) = Vector(1, {(1) = 61.2610493114}), (28, 4) = 46, (29, 1) = 0.3039225144e-8, (29, 2) = Vector(1, {(1) = -0.551292e-4}), (29, 3) = Vector(1, {(1) = 23.5619278325}), (29, 4) = 52, (30, 1) = 0.3453070599e-8, (30, 2) = Vector(1, {(1) = -0.587628e-4}), (30, 3) = Vector(1, {(1) = 48.6946768892}), (30, 4) = 62, (31, 1) = 0.3582400012e-8, (31, 2) = Vector(1, {(1) = 0.598532e-4}), (31, 3) = Vector(1, {(1) = -42.4114903226}), (31, 4) = 67, (32, 1) = 0.3734419284e-8, (32, 2) = Vector(1, {(1) = 0.611099e-4}), (32, 3) = Vector(1, {(1) = -29.8451159450}), (32, 4) = 49, (33, 1) = 0.5343604629e-8, (33, 2) = Vector(1, {(1) = 0.731000e-4}), (33, 3) = Vector(1, {(1) = 73.8274211520}), (33, 4) = 62, (34, 1) = 0.5902038576e-8, (34, 2) = Vector(1, {(1) = 0.768247e-4}), (34, 3) = Vector(1, {(1) = -26.7035219764}), (34, 4) = 54, (35, 1) = 0.6032306911e-8, (35, 2) = Vector(1, {(1) = 0.776679e-4}), (35, 3) = Vector(1, {(1) = -67.5442352858}), (35, 4) = 61, (36, 1) = 0.7371464447e-8, (36, 2) = Vector(1, {(1) = 0.858572e-4}), (36, 3) = Vector(1, {(1) = -48.6946768892}), (36, 4) = 63, (37, 1) = 0.8290250265e-8, (37, 2) = Vector(1, {(1) = -0.910508e-4}), (37, 3) = Vector(1, {(1) = 36.1283033908}), (37, 4) = 58, (38, 1) = 0.8477611289e-8, (38, 2) = Vector(1, {(1) = 0.920739e-4}), (38, 3) = Vector(1, {(1) = 86.3937926494}), (38, 4) = 64, (39, 1) = 0.1071247208e-7, (39, 2) = Vector(1, {(1) = 0.1035011e-3}), (39, 3) = Vector(1, {(1) = 45.5530836440}), (39, 4) = 61, (40, 1) = 0.1095995057e-7, (40, 2) = Vector(1, {(1) = 0.1046898e-3}), (40, 3) = Vector(1, {(1) = 39.2698969106}), (40, 4) = 47, (41, 1) = 0.1283914116e-7, (41, 2) = Vector(1, {(1) = 0.1133099e-3}), (41, 3) = Vector(1, {(1) = -70.6858282308}), (41, 4) = 57, (42, 1) = 0.1286114994e-7, (42, 2) = Vector(1, {(1) = -0.1134070e-3}), (42, 3) = Vector(1, {(1) = 67.5442352858}), (42, 4) = 67, (43, 1) = 0.1480693513e-7, (43, 2) = Vector(1, {(1) = 0.1216838e-3}), (43, 3) = Vector(1, {(1) = -51.8362700697}), (43, 4) = 61, (44, 1) = 0.1863711818e-7, (44, 2) = Vector(1, {(1) = -0.1365178e-3}), (44, 3) = Vector(1, {(1) = -20.4203335662}), (44, 4) = 52, (45, 1) = 0.1939169567e-7, (45, 2) = Vector(1, {(1) = 0.1392541e-3}), (45, 3) = Vector(1, {(1) = -98.9601639287}), (45, 4) = 55, (46, 1) = 0.2490496854e-7, (46, 2) = Vector(1, {(1) = -0.1578131e-3}), (46, 3) = Vector(1, {(1) = -76.9690140524}), (46, 4) = 62, (47, 1) = 0.3092106349e-7, (47, 2) = Vector(1, {(1) = 0.1758439e-3}), (47, 3) = Vector(1, {(1) = -92.6769783110}), (47, 4) = 54})

 

Vector[column](%id = 36893488148159589900)

(2)

 

Download roots.mw

the code shown in the attached

restart

Carl code:

T:= [[A,X],[A,Y],[A,Z], [B,X],[B,Y],[B,Z], [C,X],[C,Y],[C,Z]]:
S:= {op~(T)[]}:
P:= output((J:= Iterator:-Permute((``@op)~(T)))):
ps:= [seq](ArrayTools:-Alias(P, k, [3]), k= [0, 3, 6]):
Perms:= eval(
             [in J do if andmap(p-> {seq}(op~(p)) = S, ps) then [seq](P) fi od],
             ``= `[]`
            ):
nops(%);

2592

(1)

select( j->`and`( j[4]=[C,Z], j[7]=[B,Y]), Perms);
nops(%);

[[[A, X], [B, Z], [C, Y], [C, Z], [A, Y], [B, X], [B, Y], [A, Z], [C, X]], [[A, X], [B, Z], [C, Y], [C, Z], [A, Y], [B, X], [B, Y], [C, X], [A, Z]], [[A, X], [B, Z], [C, Y], [C, Z], [B, X], [A, Y], [B, Y], [A, Z], [C, X]], [[A, X], [B, Z], [C, Y], [C, Z], [B, X], [A, Y], [B, Y], [C, X], [A, Z]], [[A, X], [C, Y], [B, Z], [C, Z], [A, Y], [B, X], [B, Y], [A, Z], [C, X]], [[A, X], [C, Y], [B, Z], [C, Z], [A, Y], [B, X], [B, Y], [C, X], [A, Z]], [[A, X], [C, Y], [B, Z], [C, Z], [B, X], [A, Y], [B, Y], [A, Z], [C, X]], [[A, X], [C, Y], [B, Z], [C, Z], [B, X], [A, Y], [B, Y], [C, X], [A, Z]], [[B, Z], [A, X], [C, Y], [C, Z], [A, Y], [B, X], [B, Y], [A, Z], [C, X]], [[B, Z], [A, X], [C, Y], [C, Z], [A, Y], [B, X], [B, Y], [C, X], [A, Z]], [[B, Z], [A, X], [C, Y], [C, Z], [B, X], [A, Y], [B, Y], [A, Z], [C, X]], [[B, Z], [A, X], [C, Y], [C, Z], [B, X], [A, Y], [B, Y], [C, X], [A, Z]], [[B, Z], [C, Y], [A, X], [C, Z], [A, Y], [B, X], [B, Y], [A, Z], [C, X]], [[B, Z], [C, Y], [A, X], [C, Z], [A, Y], [B, X], [B, Y], [C, X], [A, Z]], [[B, Z], [C, Y], [A, X], [C, Z], [B, X], [A, Y], [B, Y], [A, Z], [C, X]], [[B, Z], [C, Y], [A, X], [C, Z], [B, X], [A, Y], [B, Y], [C, X], [A, Z]], [[C, Y], [A, X], [B, Z], [C, Z], [A, Y], [B, X], [B, Y], [A, Z], [C, X]], [[C, Y], [A, X], [B, Z], [C, Z], [A, Y], [B, X], [B, Y], [C, X], [A, Z]], [[C, Y], [A, X], [B, Z], [C, Z], [B, X], [A, Y], [B, Y], [A, Z], [C, X]], [[C, Y], [A, X], [B, Z], [C, Z], [B, X], [A, Y], [B, Y], [C, X], [A, Z]], [[C, Y], [B, Z], [A, X], [C, Z], [A, Y], [B, X], [B, Y], [A, Z], [C, X]], [[C, Y], [B, Z], [A, X], [C, Z], [A, Y], [B, X], [B, Y], [C, X], [A, Z]], [[C, Y], [B, Z], [A, X], [C, Z], [B, X], [A, Y], [B, Y], [A, Z], [C, X]], [[C, Y], [B, Z], [A, X], [C, Z], [B, X], [A, Y], [B, Y], [C, X], [A, Z]]]

 

24

(2)

 

 

Download sel.mw

The _Z just refers to any integer, since the outputs of your problem appear to occur at someValue+anyIntegerMultipleOfPi

You can aobtain values for these just by evaluating the returned expression list for _Z= some range of integer values, as in the attached. You can select from these on any basis you want

  restart:
  with(Student[MultivariateCalculus]):
  evalf~(LagrangeMultipliers(sin(x)+sin(y), [1-x-y], [x, y], output=value));
  seq( eval(%, `union`( indets~(%)[])[]=j), j=-5..5);

[.5000000000-3.141592654*_Z1, .5000000000+3.141592654*_Z1]

 

[16.20796327, -15.20796327], [13.06637062, -12.06637062], [9.924777962, -8.924777962], [6.783185308, -5.783185308], [3.641592654, -2.641592654], [.5000000000, .5000000000], [-2.641592654, 3.641592654], [-5.783185308, 6.783185308], [-8.924777962, 9.924777962], [-12.06637062, 13.06637062], [-15.20796327, 16.20796327]

(1)

 

Download LM.mw

In the codeline

points2 := [seq(`if`(abs(points[i, 1]) < 5 and abs(points[i, 2]) < 5, points[i], 0), i = 1 .. 10)];

the problem is that in the middle of your list of valid points (ie a sublist with two values) you are going to insert a '0' - which obviously isn't a point. So rather than outputting '0', you whnat to output nothing at all, whihc is achieved by using NULL as in the attached

restart

``

points := [[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.725933583e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.185566369e-1, .1572001339], [8.963609684, 7.419424024], [.7724026996, .1662719092], [1.278337644, 0.758309262e-1]]

[[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.725933583e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.185566369e-1, .1572001339], [8.963609684, 7.419424024], [.7724026996, .1662719092], [1.278337644, 0.758309262e-1]]

(1)

NULL

points2 := [seq(`if`(`and`(abs(points[i, 1]) < 5, abs(points[i, 2]) < 5), points[i], NULL), i = 1 .. 10)]

[[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.725933583e-1], [-.1254930617, .1268183497], [-0.185566369e-1, .1572001339], [.7724026996, .1662719092], [1.278337644, 0.758309262e-1]]

(2)

NULL

 

 

NULL

Download somePoints.mw

as in

restart:
with(Statistics):
alias(A = RandomVariable(Uniform(0, 1))):
alias(B = RandomVariable(Uniform(0, 2))):
alias(C = RandomVariable(Uniform(1, 2))):
F :=  (A+2*B)/C;
Mean(F);
                               A + 2 B
                          F := -------
                                  C   

                            5      
                            - ln(2)
                            2      

 

that what you want is a "simple" elementwise application of a function, as shown in the attached. (But of course I could be wrong!)

  restart;
  a:=Array(1..5, frandom(0..20));
  b:=sin~(a);

Vector[row](5, {(1) = 12.6471849245, (2) = 18.2675171228, (3) = 2.5397363259, (4) = 18.1158387415, (5) = 16.2944737279})

 

Array(%id = 36893488148081442932)

(1)

 

Download elWise.mw

the Matlab code you post is junk so let's just forget it.

The "simplest" version of Brownian motion is a fixed-step-size, random walk: there are two decisions to be made.

  1. Are we working in 2D or 3D?
  2. Is the "don't move at all" option allowed?

The code below (and in in the attached file)  produces 2D and 3D random walks.

  restart:
#
# 2D random walk
#
  randomize():
  numpoints:= 10000:
#
# Decision time is the "do not move" option allowed?
# If it is then set allowNoMove to true, otherwise
# set it to false
#
  allowNoMove:=true:
  if   allowNoMove
  then moves:= [ seq
                 ( seq
                   ( <j|k>,
                     j=-1..1
                   ),
                   k=-1..1
                 )
               ]:
  else moves:= [ seq
                 ( seq
                   ( <j|k>,
                     j=-1..1, `if`(k=0,2,1)
                   ),
                   k=-1..1
                 )
               ];
  fi:
  r:= rand(1..numelems(moves)):
  pt:= Matrix( numpoints, 2):
  pt[1,..]:=  <0|0>:
  for j from 2 to numpoints do
      pt[j,..]:= pt[j-1,..]+moves[r()]:
  od:
  plots:-pointplot( pt, style=pointline, color=red, axes=boxed);
      

  restart:
#
# 3D random walk
#
  randomize():
  numpoints:=10000:
#
# Decision time! Is the "do not move" option allowed?
# If it is then set allowNoMove to true, otherwise
# set it to false
#
  allowNoMove:=true:
  if   allowNoMove
  then moves:= [ seq
                 ( seq
                   ( seq
                     ( <i|j|k>,
                       i=-1..1
                     ), 
                     j=-1..1
                   ),
                   k=-1..1
                 )
               ]:
  else moves:= [ seq
                 ( seq
                   ( seq
                     ( <i|j|k>,
                       i=-1..1,`if`(`and`(j=0, k=0), 2, 1)
                     ),
                     j=-1..1
                   ),
                   k=-1..1
                 )
               ];
  fi:

  r:=rand(1..numelems(moves)):
  pt:=Matrix( numpoints, 3):
  pt[1,..]:= <0|0|0>:
  for j from 2 to numpoints do
      pt[j,..]:=pt[j-1,..]+moves[r()]:
  od:
  plots:-pointplot3d( pt, style=pointline, color=red, axes=boxed);

produces the plots below: NB yours may vary - I'm using the randomize() command to rest the random number generator seed, so the odds of getting the same plot twice are pretty low.

rwalks.mw

 

in the attached for the difference between GetConstant(), Constant(), evalf(Constant()) and evalf(Constant(), units).

Free advice - when using the ScientificConstants() package, I'd recommend using the Units[Standard] package.

NB The square brackets around 'units' do not appear in the Maple worksheet - not sure why they appear when inlining on this site

  restart;
  with(ScientificConstants):
  with(Units[Standard]):
  Units:-UsingSystem();
#
# GetConstant(R) returns the definition of the
# scientific constant 'R'. This will include a
# brief description, a value (in default units),
# the uncertainty in the value, and the units.
#
  GetConstant(R);
#
# evalf(Constant(R)) returns the unitfree,
# numerical value (in default units) of the
# requested constant
#
  evalf(Constant(R));
#
# evalf(Constant(R, units)) returns the value
# of the constant in default units - in this
# case 'SI'
#
  evalf(Constant(R, units));
 

SI

 

molar_gas_constant, symbol = R, value = 8.3144598, uncertainty = 0.48e-5, units = J/(mol*K)

 

8.3144598

 

8.3144598*Units:-Unit(m^2*kg/(s^2*mol*K))

(1)

#
# So for the OP's original calculation, one
# wants evalf(Constant(R, units)), as in
#
  R:= evalf(Constant(R, units));
  E:= 200000*Unit(cal/mole);
  A:= 1.4940000000*10^12*Unit(mole^(1/2)/(dm^(3/2)*min));
  T:= 306*Unit(K):
  k:= A*exp(-E/(R*T));

8.3144598*Units:-Unit(m^2*kg/(s^2*mol*K))

 

200000*Units:-Unit(cal/mol)

 

0.1494000000e13*Units:-Unit(mol^(1/2)/(dm^(3/2)*min))

 

0.2158380312e-130*Units:-Unit(mol^(1/2)/(dm^(3/2)*min))

 

0.1137566307e-130*Units:-Unit(mol^(1/2)/(m^(3/2)*s))

(2)

 

Download unitProb.mw

 

First 29 30 31 32 33 34 35 Last Page 31 of 207