Items tagged with code

I cant understend how to use new Maple workbook, and i cant load it on a site so i will use screenshoots to explain. I whant to add my costume functions to code attachments and exceuted them in multitipe workshellds, but i dont know how to excecude them from ther + i cant understend how varibles sistem work. For excemple i go main document ex1, in it i save z as global varible for all worksheed, when i excecute it works alright in other workdoxument c2 but when i change it in main document it didnt change in others, but in saved varibles in ex1 saved new value of z , and in all others z is left same as it was. In such whay i can save function f2 wich is declorated in workdocument c2 as varible, it will exceute in main ex1 but any changes of f2 in c2 wudent be applied in ex2, if i declorated and excecude f1 in c1 code attachment it dont even generate in varibles tables + i dont see any whay to excecute it from ex1, so here the qestion how to excecute functions saved in code attachments in other book's wordsheets and how make saved varibles usable in all book?

what does it means and what it will do. Can some one help me for solving this

Shootlib := "C:/Shoot9"; libname := Shootlib, libname; with(Shoot);

while i m receiving the following message:

"Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received Shoot "

Full program is :

restart; Shootlib := "C:/Shoot9"; libname := Shootlib, libname; with(Shoot);
with(plots):
N1 := 1.0; N2 := 2.0; N3 := .5; Bt := 6; Re_m := N1*Bt; gamma1 := 1;
FNS := {f(eta), fp(eta), fpp(eta), g(eta), gp(eta), m(eta), mp(eta), n(eta), np(eta), fppp(eta)};
ODE := {diff(f(eta), eta) = fp(eta),
        diff(fp(eta), eta) = fpp(eta),
        diff(fpp(eta), eta) = fppp(eta),
        diff(g(eta), eta) = gp(eta),
        diff(gp(eta), eta) = N1*(2.*g(eta)+(eta-2.*f(eta))*gp(eta)+2.*g(eta)*fp(eta)+2.*N2*N3*(m(eta)*np(eta)-n(eta)*mp(eta))),
        diff(m(eta), eta) = mp(eta),
        diff(mp(eta), eta) = Re_m*(m(eta)+(eta-2.*f(eta))*mp(eta)+2.*m(eta)*fp(eta)),
        diff(n(eta), eta) = np(eta),
        diff(np(eta), eta) = Re_m*(2.*n(eta)+(eta-2.*f(eta))*np(eta)+2.*N2/N3*m(eta)*gp(eta)),
        diff(fppp(eta), eta) = N1*(3.*fpp(eta)+(eta-2.*f(eta))*fppp(eta)-2.*N2*N2*m(eta)*(diff(mp(eta), eta)))
       }:
   
blt := 1.0;
IC := { f(0) = 0,
        fp(0) = 0,
        fpp(0) = alpha1,
        g(0) = 1,
        gp(0) = beta1,
        m(0) = 0,
        mp(0) = beta2,
        n(0) = 0,
        np(0) = beta3,
        fppp(0) = alpha2
      };
BC := { f(blt) = .5,
        fp(blt) = 0,
        g(blt) = 0,
        m(blt) = 1,
        n(blt) = 1};
infolevel[shoot] := 1;
 

staganation_point11.mw
 

``

restart

l := 1:

1

 

1.5

 

.5

 

[blue, green, red, yellow]

(1)

``

for j to nops(A) do R1 := 2*n/(n+1); R2 := 2*p/(n+1); R3 := 2/(n+1); sol1 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R1*(1-(diff(f(eta), eta))^2)-M*(diff(f(eta), eta)) = 0, diff(diff(theta(eta), eta), eta)+pr*f(eta)*(diff(theta(eta), eta))-R2*pr*(diff(f(eta), eta))*theta(eta)+R3*(A[j]*(diff(f(eta), eta))+B*theta(eta)) = 0, f(0) = 1, (D(f))(0) = L+b*((D@@2)(f))(0), (D(f))(20) = 1, theta(0) = 1+s*(D(theta))(0), theta(20) = 0], numeric, method = bvp); plots[odeplot](sol1, [eta, ((D@@2)(f))(eta)], color = red); fplt[j] := plots[odeplot](sol1, [eta, diff(f(eta), eta)], color = K[j], axes = boxed); tplt[j] := plots[odeplot](sol1, [[eta, theta(eta)]], color = K[j], axes = normal) end do:

 

 

``

l := 1:

1

 

[0, 1, 1.5]

 

.5

 

[blue, green, red, yellow]

(2)

for j to nops(n1) do R4 := 2*n1[j]/(n1[j]+1); R5 := 2*p1/(n1[j]+1); R6 := 2/(n1[j]+1); sol2 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R4*(1-(diff(f(eta), eta))^2)-M1*(diff(f(eta), eta)) = 0, diff(diff(theta(eta), eta), eta)+pr1*f(eta)*(diff(theta(eta), eta))-R5*pr1*(diff(f(eta), eta))*theta(eta)+R6*(A1*(diff(f(eta), eta))+B1*theta(eta)) = 0, f(0) = 1, (D(f))(0) = L1+b1*((D@@2)(f))(0), (D(f))(7) = 1, theta(0) = 1+s1*(D(theta))(0), theta(7) = 0], numeric, method = bvp); plots[odeplot](sol2, [eta, ((D@@2)(f))(eta)], color = red); fplt[j] := plots[odeplot](sol2, sol1, [[eta, diff(f(eta), eta)], [eta, diff(f(eta), eta)]], color = K1[j], axes = boxed); tplt[j] := plots[odeplot](sol2, [[eta, theta(eta)]], color = K1[j], axes = normal) end do; plots:-display([seq(fplt[j], j = 1 .. nops(n1))]); plots:-display([seq(tplt[j], j = 1 .. nops(n1))])

Error, (in plots/odeplot) invalid argument: sol1

 

 

 

``

``

sol1(0);

[eta = 0., f(eta) = 1.00000000000000044, diff(f(eta), eta) = .899599635987511914, diff(diff(f(eta), eta), eta) = -.200800728024976643, theta(eta) = 1.18657688243172332, diff(theta(eta), eta) = .373153764863445037]

(3)

sol1(.1)

[eta = .1, f(eta) = 1.08902313464617162, diff(f(eta), eta) = .881503890693141945, diff(diff(f(eta), eta), eta) = -.162309073227910134, theta(eta) = 1.22040489003745489, diff(theta(eta), eta) = .304232440930656767]

(4)

sol1(.2)

[eta = .2, f(eta) = 1.17641763749368966, diff(f(eta), eta) = .866916683092940898, diff(diff(f(eta), eta), eta) = -.130454301210374102, theta(eta) = 1.24759607023709362, diff(theta(eta), eta) = .240488988787701030]

(5)

sol1(.3)

[eta = .3, f(eta) = 1.19045803452309284, diff(f(eta), eta) = .579367537136023514, diff(diff(f(eta), eta), eta) = -.285675511621370782, theta(eta) = 1.18389221591022696, diff(theta(eta), eta) = .146013974567769960]

(6)

sol1(.4)

[eta = .4, f(eta) = 1.40000000000000034, diff(f(eta), eta) = 1.00000000000000022, diff(diff(f(eta), eta), eta) = -0.243774513041384287e-17, theta(eta) = .625958972186505536, diff(theta(eta), eta) = -.314549395236395634]

(7)

sol1(.5)

[eta = .5, f(eta) = 1.37026161183094430, diff(f(eta), eta) = .874752886901313142, diff(diff(f(eta), eta), eta) = .345911467377074400, theta(eta) = .432494259338694842, diff(theta(eta), eta) = -.382764248064397461]

(8)

sol1(.6)

[eta = .6, f(eta) = 1.36678221814533528, diff(f(eta), eta) = .771028661281065508, diff(diff(f(eta), eta), eta) = .407805382194403932, theta(eta) = .876413930517023876, diff(theta(eta), eta) = -.197648778495384870]

(9)

sol1(2)

[eta = 2., f(eta) = 2.66120522956795602, diff(f(eta), eta) = .991532161353848585, diff(diff(f(eta), eta), eta) = 0.251405465681268682e-1, theta(eta) = .635967939441598018, diff(theta(eta), eta) = -.144641270049362308]

(10)

``

``

``

 

``

``

NULL


 

Download staganation_point11.mw
 

``

restart

l := 1:

1

 

1.5

 

.5

 

[blue, green, red, yellow]

(1)

``

for j to nops(A) do R1 := 2*n/(n+1); R2 := 2*p/(n+1); R3 := 2/(n+1); sol1 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R1*(1-(diff(f(eta), eta))^2)-M*(diff(f(eta), eta)) = 0, diff(diff(theta(eta), eta), eta)+pr*f(eta)*(diff(theta(eta), eta))-R2*pr*(diff(f(eta), eta))*theta(eta)+R3*(A[j]*(diff(f(eta), eta))+B*theta(eta)) = 0, f(0) = 1, (D(f))(0) = L+b*((D@@2)(f))(0), (D(f))(20) = 1, theta(0) = 1+s*(D(theta))(0), theta(20) = 0], numeric, method = bvp); plots[odeplot](sol1, [eta, ((D@@2)(f))(eta)], color = red); fplt[j] := plots[odeplot](sol1, [eta, diff(f(eta), eta)], color = K[j], axes = boxed); tplt[j] := plots[odeplot](sol1, [[eta, theta(eta)]], color = K[j], axes = normal) end do:

 

 

``

l := 1:

1

 

[0, 1, 1.5]

 

.5

 

[blue, green, red, yellow]

(2)

for j to nops(n1) do R4 := 2*n1[j]/(n1[j]+1); R5 := 2*p1/(n1[j]+1); R6 := 2/(n1[j]+1); sol2 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R4*(1-(diff(f(eta), eta))^2)-M1*(diff(f(eta), eta)) = 0, diff(diff(theta(eta), eta), eta)+pr1*f(eta)*(diff(theta(eta), eta))-R5*pr1*(diff(f(eta), eta))*theta(eta)+R6*(A1*(diff(f(eta), eta))+B1*theta(eta)) = 0, f(0) = 1, (D(f))(0) = L1+b1*((D@@2)(f))(0), (D(f))(7) = 1, theta(0) = 1+s1*(D(theta))(0), theta(7) = 0], numeric, method = bvp); plots[odeplot](sol2, [eta, ((D@@2)(f))(eta)], color = red); fplt[j] := plots[odeplot](sol2, sol1, [[eta, diff(f(eta), eta)], [eta, diff(f(eta), eta)]], color = K1[j], axes = boxed); tplt[j] := plots[odeplot](sol2, [[eta, theta(eta)]], color = K1[j], axes = normal) end do; plots:-display([seq(fplt[j], j = 1 .. nops(n1))]); plots:-display([seq(tplt[j], j = 1 .. nops(n1))])

Error, (in plots/odeplot) invalid argument: sol1

 

 

 

``

``

sol1(0);

[eta = 0., f(eta) = 1.00000000000000044, diff(f(eta), eta) = .899599635987511914, diff(diff(f(eta), eta), eta) = -.200800728024976643, theta(eta) = 1.18657688243172332, diff(theta(eta), eta) = .373153764863445037]

(3)

sol1(.1)

[eta = .1, f(eta) = 1.08902313464617162, diff(f(eta), eta) = .881503890693141945, diff(diff(f(eta), eta), eta) = -.162309073227910134, theta(eta) = 1.22040489003745489, diff(theta(eta), eta) = .304232440930656767]

(4)

sol1(.2)

[eta = .2, f(eta) = 1.17641763749368966, diff(f(eta), eta) = .866916683092940898, diff(diff(f(eta), eta), eta) = -.130454301210374102, theta(eta) = 1.24759607023709362, diff(theta(eta), eta) = .240488988787701030]

(5)

sol1(.3)

[eta = .3, f(eta) = 1.19045803452309284, diff(f(eta), eta) = .579367537136023514, diff(diff(f(eta), eta), eta) = -.285675511621370782, theta(eta) = 1.18389221591022696, diff(theta(eta), eta) = .146013974567769960]

(6)

sol1(.4)

[eta = .4, f(eta) = 1.40000000000000034, diff(f(eta), eta) = 1.00000000000000022, diff(diff(f(eta), eta), eta) = -0.243774513041384287e-17, theta(eta) = .625958972186505536, diff(theta(eta), eta) = -.314549395236395634]

(7)

sol1(.5)

[eta = .5, f(eta) = 1.37026161183094430, diff(f(eta), eta) = .874752886901313142, diff(diff(f(eta), eta), eta) = .345911467377074400, theta(eta) = .432494259338694842, diff(theta(eta), eta) = -.382764248064397461]

(8)

sol1(.6)

[eta = .6, f(eta) = 1.36678221814533528, diff(f(eta), eta) = .771028661281065508, diff(diff(f(eta), eta), eta) = .407805382194403932, theta(eta) = .876413930517023876, diff(theta(eta), eta) = -.197648778495384870]

(9)

sol1(2)

[eta = 2., f(eta) = 2.66120522956795602, diff(f(eta), eta) = .991532161353848585, diff(diff(f(eta), eta), eta) = 0.251405465681268682e-1, theta(eta) = .635967939441598018, diff(theta(eta), eta) = -.144641270049362308]

(10)

``

``

``

 

``

``

NULL


 

Download staganation_point11.mw
 

``

restart

l := 1:

1

 

1.5

 

.5

 

[blue, green, red, yellow]

(1)

``

for j to nops(A) do R1 := 2*n/(n+1); R2 := 2*p/(n+1); R3 := 2/(n+1); sol1 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R1*(1-(diff(f(eta), eta))^2)-M*(diff(f(eta), eta)) = 0, diff(diff(theta(eta), eta), eta)+pr*f(eta)*(diff(theta(eta), eta))-R2*pr*(diff(f(eta), eta))*theta(eta)+R3*(A[j]*(diff(f(eta), eta))+B*theta(eta)) = 0, f(0) = 1, (D(f))(0) = L+b*((D@@2)(f))(0), (D(f))(20) = 1, theta(0) = 1+s*(D(theta))(0), theta(20) = 0], numeric, method = bvp); plots[odeplot](sol1, [eta, ((D@@2)(f))(eta)], color = red); fplt[j] := plots[odeplot](sol1, [eta, diff(f(eta), eta)], color = K[j], axes = boxed); tplt[j] := plots[odeplot](sol1, [[eta, theta(eta)]], color = K[j], axes = normal) end do:

 

 

``

l := 1:

1

 

[0, 1, 1.5]

 

.5

 

[blue, green, red, yellow]

(2)

for j to nops(n1) do R4 := 2*n1[j]/(n1[j]+1); R5 := 2*p1/(n1[j]+1); R6 := 2/(n1[j]+1); sol2 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R4*(1-(diff(f(eta), eta))^2)-M1*(diff(f(eta), eta)) = 0, diff(diff(theta(eta), eta), eta)+pr1*f(eta)*(diff(theta(eta), eta))-R5*pr1*(diff(f(eta), eta))*theta(eta)+R6*(A1*(diff(f(eta), eta))+B1*theta(eta)) = 0, f(0) = 1, (D(f))(0) = L1+b1*((D@@2)(f))(0), (D(f))(7) = 1, theta(0) = 1+s1*(D(theta))(0), theta(7) = 0], numeric, method = bvp); plots[odeplot](sol2, [eta, ((D@@2)(f))(eta)], color = red); fplt[j] := plots[odeplot](sol2, sol1, [[eta, diff(f(eta), eta)], [eta, diff(f(eta), eta)]], color = K1[j], axes = boxed); tplt[j] := plots[odeplot](sol2, [[eta, theta(eta)]], color = K1[j], axes = normal) end do; plots:-display([seq(fplt[j], j = 1 .. nops(n1))]); plots:-display([seq(tplt[j], j = 1 .. nops(n1))])

Error, (in plots/odeplot) invalid argument: sol1

 

 

 

``

``

sol1(0);

[eta = 0., f(eta) = 1.00000000000000044, diff(f(eta), eta) = .899599635987511914, diff(diff(f(eta), eta), eta) = -.200800728024976643, theta(eta) = 1.18657688243172332, diff(theta(eta), eta) = .373153764863445037]

(3)

sol1(.1)

[eta = .1, f(eta) = 1.08902313464617162, diff(f(eta), eta) = .881503890693141945, diff(diff(f(eta), eta), eta) = -.162309073227910134, theta(eta) = 1.22040489003745489, diff(theta(eta), eta) = .304232440930656767]

(4)

sol1(.2)

[eta = .2, f(eta) = 1.17641763749368966, diff(f(eta), eta) = .866916683092940898, diff(diff(f(eta), eta), eta) = -.130454301210374102, theta(eta) = 1.24759607023709362, diff(theta(eta), eta) = .240488988787701030]

(5)

sol1(.3)

[eta = .3, f(eta) = 1.19045803452309284, diff(f(eta), eta) = .579367537136023514, diff(diff(f(eta), eta), eta) = -.285675511621370782, theta(eta) = 1.18389221591022696, diff(theta(eta), eta) = .146013974567769960]

(6)

sol1(.4)

[eta = .4, f(eta) = 1.40000000000000034, diff(f(eta), eta) = 1.00000000000000022, diff(diff(f(eta), eta), eta) = -0.243774513041384287e-17, theta(eta) = .625958972186505536, diff(theta(eta), eta) = -.314549395236395634]

(7)

sol1(.5)

[eta = .5, f(eta) = 1.37026161183094430, diff(f(eta), eta) = .874752886901313142, diff(diff(f(eta), eta), eta) = .345911467377074400, theta(eta) = .432494259338694842, diff(theta(eta), eta) = -.382764248064397461]

(8)

sol1(.6)

[eta = .6, f(eta) = 1.36678221814533528, diff(f(eta), eta) = .771028661281065508, diff(diff(f(eta), eta), eta) = .407805382194403932, theta(eta) = .876413930517023876, diff(theta(eta), eta) = -.197648778495384870]

(9)

sol1(2)

[eta = 2., f(eta) = 2.66120522956795602, diff(f(eta), eta) = .991532161353848585, diff(diff(f(eta), eta), eta) = 0.251405465681268682e-1, theta(eta) = .635967939441598018, diff(theta(eta), eta) = -.144641270049362308]

(10)

``

``

``

 

``

``

NULL


 

Download staganation_point11.mw

 

in this program im trying to combine the result, but it showing some error can help me please

 

 

 

Walking into the big blue Maplesoft office on August 3rd was a bit nerve wracking. I had no idea who anyone was, what to expect, or even what I would be doing. As I sat in the front hall waiting for someone to receive me, I remember thinking, “What have I gotten myself into?”. Despite my worries on that first day, interning at Maplesoft has been a great experience! I never knew that I would be able to learn so much about programming and working in a company in such a short amount of time. Although Maple was a programming language that was foreign to me a couple weeks ago, I feel like I’m relatively well versed in it now. Trying to learn a new language in this short timespan hasn’t been easy, but I think that I picked it up quickly, even if I’ve had my fair share of frustrations.

Chaos Game example on Rosetta Code

At Maplesoft, I’ve been contributing to the Rosetta Code project by writing short programs using Maple. The Rosetta Code project is dedicated to creating programming examples for many different tasks in different programming languages. My summer project has been to create solutions using Maple for as many tasks as possible and to post these to Rosetta Code; the goal being to have the list of tasks without Maple implementation shrink with each passing day. It’s nice to feel like I’m leaving a mark in this world, even if it is in such a small corner of the internet.

Flipping Bits example on Rosetta Code/MapleCloud

This internship, of course, came with its share of challenges. During my work on the Rosetta Code project, I posted solutions for a total of 38 tasks. Some of them were easy, but some of them took days to complete. On some days, I felt like I was on top of the world. Everything I made turned out great and I knew exactly how to tackle each problem. Other days were slower. I’ve spent ages just staring at a computer monitor trying to figure out just how on earth I was going to make this machine do what I wanted it to do! The 24 Game task was particularly hard, but also very educational. Through this task, I learned about modules, a concept previously unknown to me. I’m fairly sure that the 24 Game also took me the longest, whereas the Increment a numerical string task took me no time at all. Despite it being easy, the Increment a numerical string task wasn’t particularly fun; a bit of a challenge is required for something to be entertaining, after all. My personal favourite was the Fibonacci n-step number sequences task. It was the first really challenging task I encountered, and for after which the feeling of finally completing a task that I spent so long on, of finally overcoming that mountain, was extremely satisfying. Not all challenges end in satisfaction, however. I often found myself accidentally doing something that made the window freeze. I would close the program, then cry a bit on the inside when I realized I just lost the past half an hour’s worth of unsaved work. Nevertheless, I’m glad I got to face all these obstacles because they have made me more resilient and a better programmer.

The following is the code for the Fibonacci n-step number sequences task

numSequence := proc(initValues :: Array)
	local n, i, values;
n := numelems(initValues);
values := copy(initValues);
for i from (n+1) to 15 do
values(i) := add(values[i-n..i-1]);
end do;
return values;
end proc:
 
initValues := Array([1]):
for i from 2 to 10 do
initValues(i) := add(initValues):
printf ("nacci(%d): %a\n", i, convert(numSequence(initValues), list));
end do:
printf ("lucas: %a\n", convert(numSequence(Array([2, 1])), list));

Maple was a great software to program with and a fairly straightforward language to learn. Having previously programmed in Java, I found Maple similar enough that transitioning wasn’t too difficult. In fact, every once in a while when I didn`t know what to do for a task, I would take a look at the Java example in Rosetta Code and it would point me in a direction or give me some hints. While the two languages are similar, there are still many differences. For example, I liked the fact that in Maple, lists started at an index of 1 rather than 0 and arrays could an arbitrary starting index. Although it was different from what I was used to, I found that it made many things much less confusing. Another thing I liked was that the for loop syntax was very simple. I never once had to run through in my head how many times something would loop for. There were such a wide variety of commands in Maple. There was a command for practically anything, and if you knew that it existed and how to use it, then so much power could be at your fingertips. This is where the help system came in extremely handy. With a single search you might find that the solution to the exact problem you were trying to solve already existed as a Maple command. I always had a help window open when I was using Maple.

Multiplication Tables example on Rosetta Code

Spending my summer coding at Maplesoft has been fun, sometimes challenging, but an overall rewarding experience. Through contributing to the Rosetta Code project, I’ve learned so much about computer programming, and it certainly made the 45 minute drive out to Waterloo worth it!

Yili Xu,
Maplesoft SHAD Intern

Hello

It has been years since I last run one of my packages (not mine actually) and consequently maple.  The package was written in Maple V and run on Maple V5.  I have used updtscr to convert the old code and not many messages came out.   The updated code does not run unfortunately.  One of the problems is the following command:

linalg[dotprod](f,map((a,b) -> diff(b,a),vars,h));

Although linalg is deprecated, that does not seem to be the problem.   Suppose h, f (vector) and vars are:

The output is:

How to avoid the conjugate? Is there a simpler way to do that?

Many thanks for your patience and help.

Regards

 

Ed

Some years ago a postdoc working with me insisted to use Maple, since he was used to it. He left me some *.mws files with some calculations we had published together. I'd like to re-use the code now, preferably transposed to C or another programming language (there is not much use of Computer algebra in the code). Unfortunately it appears not so easy. I found the free Maple reader, and at least can now see the code. However, I did not find a way to copy-paste code from the Maple reader to a text file, or any other way to store the code in readable format (avoiding the Maple reader). I try to store the code by printing from the Maple reader with a kind of pdf writer, and a process started which kept my Laptop busy for more than an hour now without any output.

At the moment it looks like the two years of Postdoc work is lost, thanks to Maple and its strange restriction policy.

Can somebody let me know how to save the Maple input code of a *.mws file in a text file?

 

 

hello friend

please run this code and resend result to me.

thank you.

 

restart;
with(LinearAlgebra); with(plots);
c[1] := 0; c[2] := 1/2;
a[2, 1] := 1/8;
b[-1] := -1/3; b[1] := 2/3; b[2] := 5/6;
bb[2] := 5/12;
s := 2;
e[1] := Matrix(s+1, 1); e[2] := Matrix(s+1, 1); e[3] := Matrix(s+1, 1); e[4] := Matrix(s+1, 1);
c[0] := 0;
for ii to s+1 do e[1][ii, 1] := 1; e[2][ii, 1] := -1; e[3][ii, 1] := c[ii-1] end do;
e[1][1, 1] := 0; e[2][2, 1] := 0; e[4] := -e[3];
A := Matrix(s+1, s+1);
for i from 3 to s+1 do for j from 2 to i-1 do A[i, j] := a[i-1, j-1] end do; A[i, 1] := A[i, 2] end do;
Id := Matrix(s+1, s+1, shape = identity);
N := Matrix(s+1, s+1);
for i to s+1 do for j to s+1 do N[i, j] := -H*A[i, j]+Id[i, j] end do end do;
Bb := Matrix(s+1, 1);
for i from 3 to s+1 do Bb[i, 1] := bb[i-1] end do;
B := Matrix(s+1, 1);
for i from 2 to s+1 do B[i, 1] := b[i-1] end do; B[1, 1] := b[-1];
Z := Multiply(Transpose(Bb), 1/N);
for i to s+1 do Z[1, i] := H*Z[1, i] end do;
Q := Multiply(Transpose(B), 1/N);
for i to s+1 do Q[1, i] := H*Q[1, i] end do;
Dh := proc (H) options operator, arrow; Matrix([[1+Multiply(Z, e[1]), Multiply(Z, e[2]), 3/2+Multiply(Z, e[3]), -1/2+Multiply(Z, e[4])], [1, 0, 0, 0], [Multiply(Q, e[1]), Multiply(Q, e[2]), 1+Multiply(Q, e[3]), Multiply(Q, e[4])], [0, 0, 1, 0]]) end proc;
k := Matrix(4, 4);
for i to 4 do for j to 4 do if i = j then k[i, j] := ep-Dh(H)[i, j] else k[i, j] := -Dh(H)[i, j] end if end do end do;
sp := unapply(collect(Determinant(k), ep), H, ep);
sol := solve(sp(H, ep), ep, explicit);
sol := simplify(map(allvalues, {sol}));
l := numelems(sol);
inequal({evalc(abs(subs(H = x+I*y, sol[1]))) <= 1, evalc(abs(subs(H = x+I*y, sol[2]))) <= 1, evalc(abs(subs(H = x+I*y, sol[3]))) <= 1, evalc(abs(subs(H = x+I*y, sol[4]))) <= 1}, x = -3 .. 3, y = -3 .. 3, color = "Nautical 1");

 

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! 

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

 

I have problem to get real answer in a simple equation. maple just give me complex answer.

how i can get parametric real answer? Ihave trid this two way but not applicaple.

with(RealDomain); assume(T::real)

My code is:
Qz := 7.39833755306637215940309264474*10^7*sqrt(1/T)*(T-297.2)/T-16242.7935852035929839431551189*sqrt(1/T)/T;

q := (.6096*(299.2-T))/(sqrt(1.60000000000000000000000000000*10^(-9)-r^2)-0.346410161513775458705489268300e-4);

with(RealDomain); assume(T::real);

e := simplify(solve({0 = q-Qz}, {T}))

and the result like:

e := {T = 1/RootOf(-609600000000000000000000000000000000000000000000000000000+(879515018020273730453559011332895956000000000000000000000000000*sqrt(-625000000*r^2+1)-761682348615485390130551939524898425387968750740910059296172487)*Z^5+(-2959335021226548863761237057896000000000000000000000000000000*sqrt(-625000000*r^2+1)+2562859306691152293409465394507279449380503585614734443742000)*_Z^3+182392320000000000000000000000000000000000000000000000000000*_Z^2)^2}

dose anyone hase any opinion?

I accidentally came across a nice Mma animation. Unfortunately, I am able to present only few frames of it in MaplePrimes. See two inconsecutive frames below

 

I find this animation very deep. I don't remember something similar. It looks like an iterative
map shown in its dynamics. Not being an expert in Mathematica, I don't understand the machinery of the generating code.
n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]
Here is its fragment translated into Maple:
>with(MmaTranslator):
>FromMma(" (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;");
map(unapply(_Z1/(0.1e-1+sqrt(_Z1 . _Z1)), _Z1), unapply(x(_Z1)-x, _Z1))
To my regret,
>FromMma(" n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]");
Error, (in MmaTranslator:-FromMma) incorrect syntax (at position 11) in last character of "...0)
r"

Hello,

I have .mla. package and I would like to create the source code associated to this package.

In the past, you have also help me to obtain the source code of procedure of the module.

Here the post where Carl Love has helped me :

http://www.mapleprimes.com/questions/203676-Open-A-Maple-Package

How can I do to create the complete source code of package directly ?

Is there a direct way enabling to not have to read one procedure by one procedure but to obtain the code source for all the package ?

Thank you for your help

 

 

I should be able to use F3 to break into a multline nested loop and insert a new line of code, and then F4 to close it up again before execution.  The F4 works for closing things up.  But the F3 does NOT work.  Is this a known problem?  Is there another way to do it short of a lot of cutting and pasting?

Euler := proc (f::procedure, a, b, alpha, n::integer)
local w, h, i, xN, yN;
w := array(1 .. 2, 1 .. n+1);
h := (b-a)/n;
i := 1;
xN := a;
yN := alpha;
while i <= n+1 do
w[1, i] = xN;
w[2, i] = yN;
print*w[1, i]
yN = yN+h*f(yN, xN);
xN = xN+h;
i = i+1
end do;
print*w
end proc

using the code generator assistant I entered the following function

p := proc (z::(float[8]))

local a::integer, accm::(float[8]), k::integer, k1::(float[8]), c;
c := Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], order = C_order, datatype = float[8]);
k1 := 1;
c[1] := evalf(sqrt(2*Pi));
a := 12;
for k to a-1 do c[k+1] := evalf(exp(a-k)*(a-k)^(k-1/2)/k1); k1 := -k1*k end do;
accm := c[1];
for k to a-1 do accm := accm+evalf(c[k+1]/(z+k)) end do;
accm := accm*evalf(exp(-z-a)*(z+a)^(z+1/2));
return accm/z
end proc

the code-generated julia code follows

function input(z)
c = [0,0,0,0,0,0,0,0,0,0,0,0]
k1 = 1
c[0] = (sqrt(2 * pi))
a = 12
for k = 1:a - 1
c[k] = (exp(a - k) * (a - k) ^ (k - 1//2) / k1)
k1 = -k1 * k
accm = c[0]
for k = 1:a - 1
accm = accm + (c[k] / (z + k))
accm = accm * (exp(-z - a) * (z + a) ^ (z + 1//2))
return(accm / z)
end

two things are wrong

1: no end after loop end

2: array index starts at 0, it should be 1 and of course the array references should reflect that

 

btw, it would be nice to be able to enter code tags like [code] code here [/code]

1 2 3 4 5 6 7 Last Page 1 of 16