MaplePrimes Questions

Hi, 

Using InertfForm, I found this strange result: 

e := (A+B)*(A+C);

ife  := InertForm:-Parse(convert(e, string));
InertForm:-Display(ife);

(A+B)*(A+C)

 

`%*`(`%+`(A, B), `%+`(A, C))

 

`%*`(`%+`(A, B), `%+`(A, C))

(1)

 

Download Precedence.mw

Why doesn't Display(..) return (A+B)*(A+C) ?

 

Can anyone assist with Heat Map plotting questions?

 

I am interested in specifically formating axis.  i.e., can an axis be labels such as RPM range text =  "0-100, 101-200, 201-300", etc.  for each bin and rotated vertical to fit.   I tried most of the plot options with no success including labeldirections=[x, y].

Also, can I invert the data so the 1,1 bin is lower left corner vs upper left? tried to reverse the indices and errored with "inverted index" without resolution.

 

Lastly, I noted that I couldn't stack a frame Text plot of same size by assigning a plot to a variable and using display to overlay them.   The heat map is always on top and transparency option doesn't let the text come through.   

 

Plt1 := HeatMap(Array3[2 .. 101, 2 .. 31], color = C_List, size = [750, 450], transparency = 0.5)

 

Thanks in advance,

Bill

 

 

 

I'm trying to solve the problem which is published in the research article. The paper is attached. 

This work done with the help of shooting technique in maple 18

1.Is it possible to solve in maple 17

2. How to obtain the triple soln

3. How to implement Shooting technique

Please anyone help me to get this 

 

restart:

with(plots):

eq1 := (1+K)*(diff(f(eta), `$`(eta, 3)))+f(eta)*(diff(f(eta), `$`(eta, 2)))+K*(diff(g(eta), eta))-2*(diff(f(eta), eta))^2-M*(diff(f(eta), eta)) = 0;

(1+K)*(diff(diff(diff(f(eta), eta), eta), eta))+f(eta)*(diff(diff(f(eta), eta), eta))+K*(diff(g(eta), eta))-2*(diff(f(eta), eta))^2-M*(diff(f(eta), eta)) = 0

(1)

eq2 := (1+(1/2)*K)*(diff(g(eta), `$`(eta, 2)))+f(eta)*(diff(g(eta), eta))-3*g(eta)*(diff(f(eta), eta))-2*K*g(eta)-K*(diff(f(eta), `$`(eta, 2))) = 0;

(1+(1/2)*K)*(diff(diff(g(eta), eta), eta))+f(eta)*(diff(g(eta), eta))-3*g(eta)*(diff(f(eta), eta))-2*K*g(eta)-K*(diff(diff(f(eta), eta), eta)) = 0

(2)

eq3 := (1+(4/3)*Rd)*(diff(theta(eta), `$`(eta, 2)))/Pr+f(eta)*(diff(theta(eta), eta))+Nb*(diff(chi(eta), eta))*(diff(theta(eta), eta))+Nt*(diff(theta(eta), eta))^2 = 0;

(1+(4/3)*Rd)*(diff(diff(theta(eta), eta), eta))/Pr+f(eta)*(diff(theta(eta), eta))+Nb*(diff(chi(eta), eta))*(diff(theta(eta), eta))+Nt*(diff(theta(eta), eta))^2 = 0

(3)

eq4 := diff(chi(eta), `$`(eta, 2))+Sc*f(eta)*(diff(chi(eta), eta))+Nt*(diff(theta(eta), `$`(eta, 2)))/Nb = 0;

diff(diff(chi(eta), eta), eta)+Sc*f(eta)*(diff(chi(eta), eta))+Nt*(diff(diff(theta(eta), eta), eta))/Nb = 0

(4)

bcs := f(0) = S, (D(f))(0) = -1, g(0) = -m*((D^2)(f))(0), (D(theta))(0) = -A*(1-theta(0)), chi(0) = 1+delta*(D(chi))(0), (D(f))(10) = 0, g(10) = 0, theta(10) = 0, chi(10) = 0;

f(0) = S, (D(f))(0) = -1, g(0) = -m*(D(f))(0)^2, (D(theta))(0) = -A*(1-theta(0)), chi(0) = 1+delta*(D(chi))(0), (D(f))(10) = 0, g(10) = 0, theta(10) = 0, chi(10) = 0

(5)

params := [K = .1, S = 2.1257, m = .5, Pr = 2, Nb = .3, Nt = .5, Sc = 2, Rd = .5, delta = .1, A = 5];

[K = .1, S = 2.1257, m = .5, Pr = 2, Nb = .3, Nt = .5, Sc = 2, Rd = .5, delta = .1, A = 5]

(6)

sol := dsolve(eval([eq1, eq2, eq3, eq4, bcs], params), numeric, output = listprocedure, maxmesh = 5000)

Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 10, got 9

 

``


 

Download Triple.mw

Dear Community,

I try to solve a simple flow problem between two fluid tanks. They are connected with a pipe and a pump. Simulation runs from 0s to 3000s. Fluid levels are H1(t), H2(t), and flow rate between the tanks is Q1(t). I operate the pump between 500s and 2000s, with a constant head, and after that I would like to shut down the system from 2000s to 2500s (i.e. for 500s Q1(t) should be 0, and consequently H1, H2 remain constant) and then reopen it again, so tanks can equilibrate. I've attached the worksheet (FlowProblem.mw).

I tried to achieve this in the event section of dsolve (indicated in red), but it seemingly did not work out. So my question is: how to correctly specify it in dsolve, so flow (Q1) remains 0. between 2000s and 2500s, and can flow again afterwards? Am I right to do it in dsolve, or is there any other way to do it?

Your kind help is appreciated in advance,

best regards

Andras

FlowProblem.mw

How do I retrieve data table from Numbers (apple) Worksheet to use in Maple Document (for fit analysis)? Information for Excel exists (not useful) pathway for me), but I could  not locate corresponding information for Numbers

I want to find fundamental matrix of the system: X(t).

Actually I need A=X(T) where T is 2*Pi.

So then I can find whether the solution is stable.

The problem is, I don't understand how to find X(t) in Maple. 

Tried to solve numerically with dsolve at t=T but the next step is not obvious.

Eq=z"(t)+3z'(t)+2z(t)=24*(exp(-3t)-exp(-4t)) how to find the gereral solution of this equation. Thank you.

If I have some similar functions, say sin(x), sin(2x)..., what approach is better:

f(i,x):=(i,x)->sin(i*x)

or

f[i](x):=x->sin(i*x)

?

Or maybe there is another way?

The second one seems more natural for me but  I've stucked with an error:

 

divide5.mw
 

NULLNULL

restart; divide5 := proc (f) local x, r; r := unapply((1/5)*f(x), x); eval(r) end proc; f := proc (x) options operator, arrow; x^2 end proc; f := divide5(f); f(3)

9/5

(1)

restart; divide5 := proc (f) local i, x, r; r := unapply((1/5)*f(i, x), i, x); eval(r) end proc; f := proc (i, x) options operator, arrow; x^2+i end proc; f := divide5(f); f(5, 3)

14/5

(2)

restart; divide5 := proc (f) local x, r; r := unapply((1/5)*f(x), x); eval(r) end proc; f[i] := proc (x) options operator, arrow; x^2+i end proc; f[5] := divide5(f[5]); f[5](3)

Error, (in f[5]) too many levels of recursion

 

NULL


 

Download divide5.mw

 


What's the matter?

Thank you for your answers.

 

I know it is not hard to write such a function, but can be tricky for all options. For 1D and uniform grid, it is straight forward to code it. The formula is here  https://en.wikipedia.org/wiki/Trapezoidal_rule#Uniform_grid

I was looking to see if Maple has this build-in. This is the equivalent of Matlab's trapz

I know about Student:-Calculus1:-ApproximateInt with option trapezoid. But this is not exactly the same. Matlab's trapz can accept just a list of numbers directly (the y values), or a a matrix of numbers (2D function), and applies trapezoidal rule. The default is unit spacing.

It is a simplified version of Student:-Calculus1:-ApproximateInt in a way, but I found trapz easier to use, if one has list of numbers generated before, (i.e. function values) and want to applies trapezoidal rule on it as is. It is more more convenient that way.

Here is an example from Matlab's help. Given

Y = [1 4 9 16 25];
Q = trapz(Y)

it gives 42.

One does not need to define f(x) or x=from..to  as in the case with Maple's ApproximateInt.

Matlab's trapz also supports Matrix as input not just 1D list of numbers.

Does Maple have something similar?

 

 

 

Hi

 

I want to write this system and solve it by picard iteration method

but I don't know how to write a system of ODE in maple

 

x'=cos (x)    x(0)=1

y'= sin (z)    y(0)=-1

z'= zy           z(0)=2

 

I have to copy and paset c(n), and my final results are the square root of what they should be.

```

f:=(x-1)/(x+2)
                               -1 + x
                          f := ------
                               x + 2

plot(f,x=-3..3)


sum(k -> 1/k^2, k=1..1000)
                             1000 f

series(f,x=0);
          1   3     3  2   3   3   3   4   3   5    / 6\
        - - + - x - - x  + -- x  - -- x  + -- x  + O\x /
          2   4     8      16      32      64           

s:=convert(f,FormalPowerSeries)
                          /infinity           \
                          | -----             |
                          |  \     /      k  \|
                          |   )    |   3 x   ||
                 s := 1 + |  /     |- -------||
                          | -----  |        k||
                          \ k = 0  \  2 (-2) //

simplify(s,symbolic)
                 /infinity                       \
                 | -----                         |
                 |  \                            |
                 |   )    /       k  (-k - 1)  k\|
             1 + |  /     \-3 (-1)  2         x /|
                 | -----                         |
                 \ k = 0                         /

                             c := c

c:=k->-(3 *x^k)/((2 (-2)^k))
c(k)
                                  k
                               3 x
                             - ----
                                k  
                               2  x

abs( ((c(k+1)*(x^(k+1)))) / ((c(k)*x^k)));
                               2 |    k   |
                     | (k + 1)|  |   2    |
                     |x       |  |--------|
                                 | (k + 1)|
                                 |2       |
                     ----------------------
                                 2         
                             | k|          
                             |x |          

simplify( % );
                                    2
                          | (k + 1)|
                          |x       |
                          -----------
                                  2  
                              | k|   
                            2 |x |   

L:= limit( %, k=infinity );
                               1    2
                          L := - |x|
                               2     

solve( L<1, x);


```

```

with(plots)

witth(plottools)

f:=(x-1)/(x+2)

p1:=plot(f,x=-3..3):
p2≔circle([0,0],1,color=blue); #add a circle to plot, would like to figure out how to do automatically
           p2&Assign;circle([0, 0], 1, color = blue)

display(p1,p2);
```

I'm able to plot f(x), but not plot the circle.

Hi

I use DocumentTools:-Tabulate to display two plots side by side, each of them in separate cells.
For instance

wp := 800:
wt := 90:

p := plot(x, x=0..1, axes=boxed, size=[wp, 400]):
q := plot(x^2, x=0..1, axes=boxed, size=[wp, 400]):
DocumentTools:-Tabulate([p, q], width=wt)

I'm able to adjust wp in such a way that, for a given value of wt, each plot "fills" the cell in which it is located (first example in the attached file).

But it seems that this adjustement is not possible if p and/or q is not a "plot" structure but a "dualaxisplot" structure (second example in the attached file).

Does it exist a workaround for this?
TIA


restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

with(DocumentTools):
with(DocumentTools:-Layout):

wp := 800:
wt := 90:

p := plot(x, x=0..1, axes=boxed, size=[wp, 400]):
q := plot(x^2, x=0..1, axes=boxed, size=[wp, 400]):
Tabulate([p, q], width=wt)

r := plots:-dualaxisplot(p, q, size=[wp, 400]):
Tabulate([r, p], width=wt)

 


Download PlotSize.mw

 

Requesting a procedure to calculate primes p for which there exists a prime q <= p such that pi(p)=q-pi(q), where pi is the prime counting function. If possible options to select output as p, or as (p,q).

p list starts:2,13,17,29,31,43.....

q list starts: 2,11,13,17,19,23...

Thanks in advance,

David.

Maple mint checks for errors in one file only at a time. But not across mutliple files for correctness of calls between them. (As is done in statically complied langauges, where the compiler has access to all files and can do this).

One has to run the code to find such errors. For example, given

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2);

foo:=proc(n::integer,m::string,$)
 print("in foo, n=",n, "m = ",m );
end proc;

boo:=proc()
#How to make Maple check this call is wrong using mint? 
#before running the code? It has wrong type, and also
#missing one argument.

 foo(0.1);   
end proc;

Doing 

maplemint(boo)
maplemint(foo)

shows no errors. 

In a large program, with many calls between many procs in different packages, it will be nice if one can detect such errors before running the program if possible, than having to run the program, making sure all possible paths are taken each time.

Such an error could be hidden in the code for  sometime without one noticing it (For example, if one changes the API to a proc, but not change each call to the changed proc in order to update the call to the new API), and the code path for the now wrong call is not invoked in the current test since testing does not do 100% coverage all the time.

Is there any option in mint I might overlooked to do this?  if not, how hard would it be for Maple to add such a feature? i.e. give mint, either a set of files, or .mla library, and have it check all calls between all functions, for correctness.
 

First 346 347 348 349 350 351 352 Last Page 348 of 2308