Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi everybody,

 

I want to plot many curves in the form of a table.

For instance, let    p := plot(x, x=0..1, labels=[x*Unit('m'), y*Unit('m')]):

The command   plots:-display(p)  returns a plot  with labels x [[m]] and y [[m]], just as expected.

But the commands (remember I have several plots)
                             plots:-display(<p>);                              # and the generalization plots:-display(<p | p>)
                             DocumentTools:-Tabulate([p]);           # and the generalizationDocumentTools:-Tabulate([p,p])
both provide labels  x Units:-Unit('m') and  y Units:-Unit('m')

Is there a way to fix this and obtain plots withe the expected labels ?

Thank to all of you for yout help

how to get numerical values of the following:


cos(pi/2)^2  where square should be on cos not on angle

 i need a help on how to find the local truncation error of a hybird block method of three order IVP. here is the one of the discrete methods i need to find the local truncation error. please any solution should put here thanks 

I want to obtain a report in a particular table format in TextArea component.REPORT (TextArea)area and ComboBox are not visble here.

Can any one help me? TextBox_Format_Output_Request.mw
 

restart

z := "Maple1"; x := "Map"; y := "Maple2"; x1 := 9.080787; y1 := 9.98765; z1 := 8.090909

I have done it using the print format directly with variable values. This is fine for me.

Maple:        Maple:     Map

  9.9876:   9.0808       8.1

 

I have done it differently defining a variable for the print format. This is fine for me and required as standard.

y3 := "%-2.5s:        %2.5s:     %2.5s\n  %-2.5g:   %-2.5g       %-3.2g\n", z, y, x, y1, x1, z1

printf(y3)

Maple:        Maple:     Map
  9.9876:   9.0808       8.1

 

 

Now I want these two lines as per format print  inside textarea0 named REPORT.

``

                                 

 

SetProperty("REPORT", Value, "")``

 

 

``

 

 

``


 

Download TextBox_Format_Output_Request.mw

I attach the doc for clarity of my odoubt. I have made all the required compoennets commands except for the formatting of printf formaat. Thanks for help.

Ramakrishnan V

Hi

 

trying to make table of points of the pair(lambda1,lambda2) to get the approximate function this technique  is called interpolation

contourplot(4*lambda2*result^2/(Pi*(lambda2+1)^2)-lambda1,lambda1=0..1,lambda2=0..1,contours=[0],axes=boxed,title=tit,titlefont=[SYMBOL,16],thickness=1,color=black,font=[1,1,18],tickmarks=[2, 4],linestyle=1,view=[0.002..1,0.002..1]);

any one knows how to find it

Hello everyone,

I need your helps .I have this code to solve equation numerically with random coefficients, but sometimes the solution find a singularity, for that I create conditional if to avoid it , but its does not work.

Thank you a lot.

 

NULL

restart

eq := a*(diff(x(t), `$`(t, 2)))+b*(diff(x(t), `$`(t, 1)))+sin(x(t))*(diff(x(t), `$`(t, 1)))+2/x(t);

  

cis := x(0) = .25, (D(x))(0) = 0;

 

Simpson := proc (f, a, b, n) local h, S1, S2, S, i; h := evalf(((1/2)*b-(1/2)*a)/n); S1 := 0.; for i from 0 to n-1 do S1 := S1+f(a+(2*i+1)*h) end do; S2 := 0.; for i to n-1 do S2 := S2+f(a+2*i*h) end do; S := (1/3)*h*(f(a)+f(b)+4*S1+2*S2); return S end proc:

 

amin:=0.1;amax:=0.2;

 

bmin:=15;bmax:=24;

 

Q1 := []; for jj to 10 do simplfloat := rand(-1.0 .. 1.0); h := simplfloat(); a := abs(amin+(amax-amin)*h); b := abs(bmin+(bmax-bmin)*h); solut := dsolve([eq, cis], numeric, maxfun = 0, output = procedurelist); sd := proc (i) options operator, arrow; abs(rhs(solut(i)[2])*rhs(solut(i)[2])) end proc; eng := Simpson(sd, 5, 6, 10); if 'FAIL' then return  else  end if; Q1 := [op(Q1), [jj, a, b, h, eng]]; writedata("test.dat", Q1) end do

Error, (in solut) cannot evaluate the solution further right of .22544264, probably a singularity

 


 

Download g.mw

Hi all,

I am hoping to use Maple to develop a list of 4 distinct linear factors with the following conditions...

1)  each individual factor does not have a common integer factor...  ie...  3x+9 is not permitted

2)  the coefficients in each individual factor has an integer between (-9 and 9) without the possibility of zero...  ie x + 0 and 0*x +3 are not permitted

3) each seperate factor is prime to one-another.  ie.  factor1=3x+4  and factor2=-3x-4 is not permitted.

I was hoping to use something short and sweet, using a sequence (if possible), but continue to run into problems.

Any help out there would be fantastic

Thanks,

Mark

 

 

Would someone be able to explain this strange output?

restart;
sol:=int(1/(x*sin(x)),x);
algsubs(x=t,sol);

How did Maple manage to obtain this? I tried tracing but it did not help me figure it out.  If it is of any help:

int(1/sin(x),x);

It seems algsubs got confused somewhere?

 

 

Maple 2017.2, windows.

 

 

I am learning how to use Threads. I looked for an example code in Start / Programming / Example: Task Model and Multithreaded Programming. I found a MandelBrot code, which I was able to change a value in the If -then statement to run in Threads or no Threads mode. I added a time() function to get a sense of the execution time. The results are about 140s with Threads and 91s with no Threads. I would have thought that the execution time would be smaller in the Threads mode than in the no Threads mode. Did I assume incorrectly that I was creating a Threads and no Threads situations by modifying the if-then statement? Or is this not good example? Here is the code:

Threads_Ex3a.mw

with(PDEtools); declare(u(x, y, z, t), U(X, Y, Z, T)); interface(showassumed = 0); assume(a > 0, p > 0); W := diff_table(u(x, y, z, t)); E := 6*W[]*W[x]+W[t]+W[x, y, z] = 0; InvE := proc (PDE) local Eq1, Eq2, Eq3, Eq4, tr1, tr2, tr3, tr4, term1, term2, term3, term4, sys1; tr1 := {t = T/a^beta, x = X/a^alpha, y = Y/a^mu, z = Z/a^nu, u(x, y, z, t) = U(X, Y, Z, T)/a^zeta}; tr2 := eval(tr1, zeta = 1); Eq1 := combine(dchange(tr2, PDE, [X, Y, Z, T, U])); Eq2 := map(lhs, PDE = Eq1); term1 := select(has, select(has, select(has, rhs(Eq2), a), beta), a); term2 := expand(rhs(Eq2)/term1); term3 := select(has, select(has, term2, a), a); sys1 := {select(has, op(1, term3), a) = 1, select(has, op(2, term3), a) = 1}; tr3 := solve(sys1, {alpha, beta, mu, nu}); tr4 := subs(tr3, tr2); print(tr3, tr4); Eq3 := dchange(tr4, PDE, [X, Y, Z, T, U]); term4 := select(has, op(1, lhs(Eq3)), a); Eq4 := expand(Eq3/term4); PDE = simplify(Eq4) end proc; InvE(E)

> restart;
> u := c-6*mu*(1+lambda*sqrt(-mu)*coth(A+sqrt(-mu)*(x+y+mu*t)))/((a+b)*sqrt(-mu)*coth(A+sqrt(-mu)*(x+y+mu*t)))+6*mu*sqrt(sigma*(1-coth(A+sqrt(-mu)*(x+y+mu*t))^2))/(sqrt(sigma)*(a+b)*sqrt(-mu)*coth(A+sqrt(-mu)*(x+y+mu*t)));
            /                (1/2)     /         (1/2)               \\
       6 mu \1 + lambda (-mu)      coth\A + (-mu)      (x + y + mu t)//
   c - ----------------------------------------------------------------
                         (1/2)     /         (1/2)               \     
            (a + b) (-mu)      coth\A + (-mu)      (x + y + mu t)/     

                                                                 (1/2)   
               /      /                                       2\\        
               |      |        /         (1/2)               \ ||        
          6 mu \sigma \1 - coth\A + (-mu)      (x + y + mu t)/ //        
      + -----------------------------------------------------------------
             (1/2)              (1/2)     /         (1/2)               \
        sigma      (a + b) (-mu)      coth\A + (-mu)      (x + y + mu t)/
> c := 1;
                                      1
> mu := -1.5;
                                     1.5
> lambda := 1.5;
                                     1.5
> a := 1;
                                      1
> b := 1;
                                      1
> A := .5;
                                     0.5
> y := 0;
                                      0
> plot3d([abs(u)], x = -10 .. 3, t = -10 .. 3);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

> restart;
> u := a[0]-12*sqrt(mu)*(1+lambda*sqrt(mu)*tan(A-sqrt(mu)*(x+y+4*mu*t)))/((a+b)*tan(A-sqrt(mu)*(x+y+4*mu*t)));
              (1/2) /             (1/2)    /      (1/2)                 \\
         12 mu      \1 + lambda mu      tan\A - mu      (x + y + 4 mu t)//
  a[0] - -----------------------------------------------------------------
                                /      (1/2)                 \            
                     (a + b) tan\A - mu      (x + y + 4 mu t)/            
> a[0] := 2;
                                      2
> mu := 1.5;
                                     1.5
> lambda := 2;
                                      2
> a := .5;
                                     0.5
> b := .5;
                                     0.5
> A := 1.5;
                                     1.5
> y := 0;
                                      0
> plot3d([abs(u)], x = -3 .. 3, t = -3 .. 3);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

i have a problem with readstat, when using proc , the readstat command returns some errors and do not complete the reading procedure, but without using proc, it is ok, what should i do ? is this a bug?
 

Download read.mw

Was just pondering this idea and posted this in the post topic for discussion. 

Each Maple finished version of Maple may still have certain bugs that will not be updated for that version, so I am suggesting (I think anyone could implement it) that if there is a workaround, one could wrap it up in something I would call a patch package updateable by us users we could update here on mapleprimes.  It would be good for people who haven't upgraded or can't upgrade due to costs etc...

For example, there was recent issue with pdsolve that was fixed quite quickly in the seperate updateable Physics package.  Things could be done similarily that might work with other workarounds using this patch package idea. 

If anyone thinks this is good or even viable idea then lets implement it.  I envisioned it with just this one rule to follow - the name of the patch package would reflect the version we are patching (ie. with(patch12) or with(patch2016) for Maple 12 and Maple 2016 respectively etc...)  We could make these patch packages available in this post or start another.

As I said, I'm just throwing the idea out there.  Thoughts?

Hi. I would like to learn to use your package. The example  document for it not running (for me). Included a screen shot and my test document. Basicially It would like to import .mpl procedures and use them as the exports of a module/package. I have no experience with code editors and this is the first time I have tried to use the code edit region. Also whathat does the (**) mean/do?

Edit: I redid the documet.

restart

with(CodeBuilder)

[Build, Directory, Export, File, Import, Mint, Read, Regions, Version]

(1)

"Directory("interface('worksheetdir')")"

"C:\Users\Ronan\AppData\Local\Temp\Rtestm"

(2)

Regions()

["Rtestm.mpl", "NewTest.mpl", "NewTest_ModuleApply.mpl"]

(3)

libname

"C:\Program Files\Maple 2017\lib", "C:\Users\Ronan\maple\toolbox\CodeBuilder\lib", "C:\Users\Ronan\maple\toolbox\personal\lib"

(4)
Rtestm := module ()

_m2199891725024

["C:\Users\Ronan\AppData\Local\Temp\Rtestm\Rtestm.mpl", "C:\Users\Ronan\AppData\Local\Temp\Rtestm\NewTest.mpl", "C:\Users\Ronan\AppData\Local\Temp\Rtestm\NewTest_ModuleApply.mpl"]

``

NewTest:=module()

"This is a NEW TEST"

_m2199890918688

``

``

ModuleApply:=proc()

proc () print("This is a NEW TEST") end proc

``

"" CodeBuilder:-Build"('mint','maplet', 'infolevel'=2,  'prefix' = "#!",  'main' = "Rtestm.mpl");"

mint, maplet, infolevel = 2, prefix = "#!", main = "Rtestm.mpl"

(5)

Rtestm:-Rtest()

"this is a test"

(6)

""Rtestm:-NewTest"()"

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry"

(7)

restart

Read*"C:\\Users\\Ronan\\AppData\\Local\\Temp\\Rtestm\\Rtestm.mpl"

Read*"C:\Users\Ronan\AppData\Local\Temp\Rtestm\Rtestm.mpl"

(8)

Rtestm:-Rtest()

Error, Rtest is not a command in the Rtestm package

 

Rtestm:-NewTest()

Error, NewTest is not a command in the Rtestm package

 

``

Download 1-CodeBuilder_Pkg_test.mw

@Joe Riel 

First 919 920 921 922 923 924 925 Last Page 921 of 2215