Maple Toolboxes Questions and Posts

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

How to random generate 2 integer number with condition x must be less than y ?

I had tried the coding below. But the output shown not what i want.

x:=RandomTools[Generate](integer(range=1..7);

y:=RandomTools[Generate](integer(range=1..7);

if x>= y then x:=RandomTools[Generate](integer(range=1..7); y:=RandomTools[Generate](integer(range=1..7); end if;

 

Example:

I get x:= 5 , y:=1, then i need to regenerate the value of x and y using the last statemet above. but the problem is sometime i might still get the value of x>= y for example on second generate x:3, y=2. I need a code that x and y must be regerate until it get x<y. Can someone help ? Thank you in advance.

 

I got a code file and i dont know how to load it in Linux. In Windows i just type:

read "E:/code.txt"

But thing now i change to use Linux and cant do the same (Maple 2015 64bit Linux ver), try to load

read "/root/Desktop/code.txt"

It show me that:

I click Cancel and it show me:

Hope can help me another ways to use and load my code to run.

Hello i would love some help with this code i need Maple to make an exercise guide in word automaticly the thing is that i don't know how to automaticly insert the plot in the word, i think there is no fprintf format to add images or plots maybe with exportplot? i really don't know; here is the Code is Basic for a starter student i just need the comand to insert the plot just that.
-------------------------------------------------------------------
fd:fopen("Graphs.doc", WRITE);
 for i from 1 by 5 to 11do
  if i=1 then plotsetup(bmp,plotoutput=plot1);
 a:= -50;
 b:=30;
 elif i=6 then
 plotsetup(bmp,plotoutput=plot2);
 a:= 50;
 b:=-30;
  elif i=11 then  plotsetup(bmp,plotoutput=plot3);
  a:= 2;
 b:=-3;
 end if;
 h:=(i*x^(2)-((3*a)/(i-42))*x-(i*b)/(-i+42));
  fprintf(fd,"the quadratic equation is: ")
fprintf(fd,"%q \\n",h);
 #`HERE IS WHERE I NEED THE PLOT TO BE`
  plot(i*x^(2)-((3*a)/(i-42))*x-(i*b)/(-i+42),x)
   end do; 
 fclose(fd);
--------------------------------------------------------------------
pd. i can't do it manually i need it to be automatic later i will add some inputs to make it even faster.

Why can't I run a produce on the Maple IDE? I can't add Maple environment to Maple IDE. The error is this.

License expires in 29 days
|\^/| Maple 18 (X86 64 WINDOWS)
._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2014
\ MAPLE / All rights reserved. Maple is a trademark of
<____ ____> Waterloo Maple Inc.
| Type ? for help.
Error: EnvUtils:-KernelSummary("could not validate license %1, required by %2. Please check the Install.html file under the toolbox directory for instructions on how to activate a license.\nLicense manager error: %3")
memory used=0.7MB, alloc=8.3MB, time=0.11

I have been puzzled by a matlab toolbox problem for a long time. How can I get Maple notation in matlab output?

Both "Input display" and "Output display" in Tools-->Options-->Display was changed from "2-D Math notation" into "Maple notation". And the output in Maple is indeed Maple notation like this:maple output

But the output in matlab is also 2-D notation like this:matlab output

when copy it to Matlab or Maple as input, it become the wrong issues like this:wrong style

How can I output Maple notation in matlab? The version is Maple 18 and Matlab 2014b, respectively.

 

 

Does anyone in the community know example worksheets that analyze "billiards", viz. trajectory sets of free, specularly reflected particles constrained to bounce around in a particular 2d domain?

Are there any examples using the Bunimovich Stadium Billiard?

Thanks,

Bob Terry

I want to simulate Inelastic collision

 

 

There has 2 ball which I can change  Quality and Radius.

 

 

 

one ball  move to another stirless ball with diferent angle

Dear Friends,

My present problem is to calculate the coefficients  

of ODES based on the experiment data. In order to simulate the actual experiment, a set of  is given with . Then the experiment data (yexp) can be calculated. Finally, the least-squares method (lsq) is used to calculate the coefficient values. Now the NLPSolve function can be used. However, the globalsolve cant run.

 

If it is convenient for you, wish you can solve it.

 

Code:

 

restart;
cdm_ode := diff(y1(t), t) = c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t)), diff(y2(t), t) = ks*y2(t)^(1/3)*(1-y2(t)), diff(y3(t), t) = h1*(1-y3(t)/h2)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(sigma*(1-y2(t))), diff(y4(t), t) = (1/3)*kp*(1-y4(t))^4, diff(y5(t), t) = A*B*y1(t)^(B-1)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t)), diff(y6(t), t) = y6(t)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t));

 

tol_t := 3600;
sol := dsolve([cdm_ode, y1(0) = 0, y2(0) = 0, y3(0) = 0, y4(0) = 0, y5(0) = 0, y6(0) = 175], numeric, range = 0 .. tol_t, output = listprocedure, parameters = [c0, n, sigma, s0, ks, h1, h2, kp, A, B]);

sol(parameters = [5.7*10^(-6), 10.186, 175, 200, 5*10^(-8), 10000, .269, 1.5*10^(-7), 1.5, 2]);

t := [seq(i^2, i = 0 .. 50, 1)];

y1data := subs(sol, y1(t));
 
y1exp := [seq(y1data(t[i]), i = 1 .. 51)];

err := proc (c0, n, s0, ks, h1, h2, kp, A, B) local y1cal, y1val, lsq; sol(parameters = [c0, n, 175, s0, ks, h1, h2, kp, A, B]); y1cal := subs(sol, y1(t)); y1val := [seq(y1cal(t[i]), i = 1 .. 51)]; lsq := add((y1val[i]-y1exp[i])^2, i = 1 .. 51); lsq end proc;

with(Optimization);
val := NLPSolve(err, 10^(-8) .. 10^(-4), 2 .. 20, 150 .. 250, 10^(-2) .. 1, 100 .. 20000, 10^(-5) .. .4, 10^(-5) .. 1, .5 .. 2, 1 .. 10);
GlobalSolve(err, 10^(-10) .. 10^(-4), 2 .. 20, 150 .. 250, 0 .. 1, 100 .. 15000, 0 .. .5, 0 .. 1, .5 .. 2, 1 .. 5);


Error, (in GlobalOptimization:-GlobalSolve) `InertForms` does not evaluate to a module

 

 

 

 

 

I would like to pay attention to a series of applications by Samir Khan
http://www.maplesoft.com/applications/view.aspx?SID=153600
http://www.maplesoft.com/applications/view.aspx?SID=153599
http://www.maplesoft.com/applications/view.aspx?SID=153596
http://www.maplesoft.com/applications/view.aspx?SID=153598
My congratulations to the author on his work well done. New capacities of Global Optimization Toolbox are spectacular. For example, in the first application  an optimization
problem in 101 variables under 5050 nonlinear  constraints
(other than 202 bounds) is solved.
I think it requires a very powerful comp and much time.
I tried that  problem for n=20 with the good old DirectSearch
on my comp (4 GB RAM, Pentium Dual-Core CPU E5700@3GHz) by

soln2 := DirectSearch:-GlobalSearch(rc, {cons1, cons2, rc >= 0,
seq(`and`(vars[i] >= -70, vars[i] <= 70), i = 1 .. 2*n), rc <= 70},
variables = vars, method = quadratic, number = 140, solutions = 1,
evaluationlimit = 20000)

and obtained not so bad rc=69.9609360106765 (whereas www.packomania.com gives rc=58.4005674790451137175957) in about one hour.

Packing_by_DS.mw
For n=50 the memory of my comp cannot allocate calculations or the obtained result by the Search command is far away from the one in packomania.

 

I want to get numerical solution of the Eqs.ode(see the folowlling ode and ibc)in Maple.However,when i run the following procedure,it prompts an error "Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile, please specify an approximate initial solution". How to solve the issue? Please help me.


restart:
n := 1.4; phi := 1; beta := .6931; psi := 1

> restart;
> n := 1.4; phi := 1; beta := .6931; psi := 1;

> s := proc (x) options operator, arrow; evalf(1+(phi*exp(beta*psi)*h(x))^n) end proc;

> Y := proc (x) options operator, arrow; evalf(f-(1/2-(1/2)/n)*ln(s(x))+2*ln(1-(1-s(x))^(-1+1/n))) end proc;


> ode := diff(h(x), `$`(x, 2))+(diff(Y(x), x))*(diff(h(x), x)+1) = 0;


> ibc := h(0) = 0, ((D(h))(10)+1)*s(10)^(-(1-1/n)*(1/2))*(1-(1-1/s(10))^(1-1/n))^2 = 0;

> p := dsolve({ibc, ode}, numeric);
Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile, please specify an approximate initial solution
>

Hi Mapleprimers,

I was wondering if there way a way to use restart(); and clear Maple's memory, but protect the memory in a certain variable?  I would like to return the memory to the operating system, but keep a symholic function in memory.

Alternatively, is there a way to save a symbolic function to a file, then reload it at a seperate time?

 

Hi MaplePrime-ers,

I'm using Maple17 in Matlab 2012b to evaluate a symbolic function over a grid of values.  The number of values is generally ~500k, and therefore I have a loop that dumps the solutions into MATLAB where the values are parsed and stored more efficiently.

I put this proceess in an optimization routine, and I keep getting crashes.  The crashes are NOT repeatable.  They generally happen after 4-10 times the routine has been called.  

This is one of the stack dumps.  Anybody have any ideas?  I talked to MATLAB support, but they weren't very useful (they started pointing fingers).


------------------------------------------------------------------------
Segmentation violation detected at Wed Jun 4 17:38:11 2014
------------------------------------------------------------------------

Configuration:
Crash Decoding : Disabled
Current Visual : 0x24 (class 4, depth 24)
Default Encoding: UTF-8
GNU C Library : 2.15 stable
MATLAB Root : /opt/Matlab/R2012b
MATLAB Version : 8.0.0.783 (R2012b)
Operating System: Linux 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64
Processor ID : x86 Family 6 Model 23 Stepping 6, GenuineIntel
Virtual Machine : Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The XFree86 Project, Inc (40300000), display wildnode0:15.0

Fault Count: 1


Abnormal termination:
Segmentation violation

Register State (from fault):
RAX = 00007f3bcc0a80c0 RBX = 00007f3b97fe6000
RCX = 0000000000000000 RDX = 00007f3bcc0a84a0
RSP = 00007f3b8cb29d60 RBP = 0000000000000003
RSI = 5851f42d4c957f2d RDI = 00007f3bde026360

R8 = 65a1566174cc9e28 R9 = 0000000000000002
R10 = 00007f3b8cb29d90 R11 = 0000000000002e88
R12 = 0000000000000001 R13 = 00007f3b8cb29df0
R14 = 0000000000000000 R15 = 0000000000000003

RIP = 00007f3b977d0604 EFL = 0000000000010283

CS = 0033 FS = 0000 GS = 0000

Stack Trace (from fault):
[ 0] 0x00007f3c962b01de /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00516574 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+000158
[ 1] 0x00007f3c962b14b2 /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00521394
[ 2] 0x00007f3c962b2ffe /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00528382 _ZN2fl4diag13terminate_logEPKcRKNS0_14thread_contextE+000174
[ 3] 0x00007f3c9559f093 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00557203 _ZN2fl4diag13terminate_logEPKcPK8ucontext+000067
[ 4] 0x00007f3c9559bb9d /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00543645
[ 5] 0x00007f3c9559d835 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00550965
[ 6] 0x00007f3c9559da55 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00551509
[ 7] 0x00007f3c9559e0fe /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00553214
[ 8] 0x00007f3c9559e295 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00553621
[ 9] 0x00007f3c93a86cb0 /lib/x86_64-linux-gnu/libpthread.so.0+00064688
[ 10] 0x00007f3b977d0604 /opt/maple17/bin.X86_64_LINUX/libmaple.so+01824260
[ 11] 0x00007f3b977cfc48 /opt/maple17/bin.X86_64_LINUX/libmaple.so+01821768
[ 12] 0x00007f3b977d2f88 /opt/maple17/bin.X86_64_LINUX/libmaple.so+01834888
[ 13] 0x00007f3b9763d63f /opt/maple17/bin.X86_64_LINUX/libmaple.so+00173631
[ 14] 0x00007f3c93a7ee9a /lib/x86_64-linux-gnu/libpthread.so.0+00032410
[ 15] 0x00007f3c937ab3fd /lib/x86_64-linux-gnu/libc.so.6+01000445 clone+000109


If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/

A technical support engineer might contact you with further information.

Thank you for your help.

Data.xlsx

XY.mw

XYZ.mw

 

Hello,

I'm using the Global Optimization Toolbox to solve some examples and fit equations to a given data, finding "unknown" parameters. I generated the data on Excel, and I already know the values of these parameters.

The XY case is (there is no problem here, I just put as a example I follow):

> with(GlobalOptimization);
> with(plots);

> X := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "I5:I25");
> Y := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "J5:J25");

> XY := zip( (X, Y) -> [X, Y] , X, Y);
> fig1 := plot(XY, style = point, view = [.9 .. 3.1, 6 .. 40]);


> Model := A+B*x+C*x^2+D*cos(x)+E*exp(x):
> VarInterv := [A = 0 .. 10, B = 0 .. 10, C = -10 .. 10, D = 0 .. 10, E = 0 .. 10];

> ModelSubs := proc (x, val)

    subs({x = val}, Model)

    end proc;


> SqEr := expand(add((ModelSubs(x, X(i))-Y(i))^2, i = 1 .. 21));
> CoefList := GlobalSolve(SqEr, op(VarInterv), timelimit = 5000);

> Model := subs(CoefList[2], Model):

 

I could find the right values of A, B, C, D and E. 

 

My problem is in the XYZ case, where I don't know how to "write" the right instruction. My last attempt was:

> with(GlobalOptimization);
> with(plots);

> X := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "Q5:Q25"); X2 := convert(X, list);
> Y := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "R5:R25"); Y2 := convert(Y, list);
> Z := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "S5:S25"); Z2 := convert(Z, list);
> NElem := numelems(X);

> pointplot3d(X2, Y2, Z2, axes = normal, labels = ["X", "Y", "Z"], symbol = box, color = red);

 

> Model := A*x+B*y+C*sin(x*y)+D*exp(x/y);

> VarInterv := [A = 0 .. 10, B = 0 .. 10, C = 0 .. 10, D = 0 .. 10];

> ModelSubs:=proc({x,y},val)

subs({(x,y)=val},Model)

end proc:
Error, missing default value for option(s)

> SqEr := expand(add((ModelSubs(x, y, X(i), Y(i))-Z(i))^2, i = 1 .. NElem));
> CoefList := GlobalSolve(SqEr, op(Range), timelimit = 5000);
Error, (in GlobalOptimization:-GlobalSolve) finite bounds must be provided for all variables

 

My actual problem involves six equations, six parameters and four or five independent variables on each equation, but I alread developed a way to solve two or more equations simultaneously.

Thanks

Hi MaplePrimers,

I'm trying to solve a system of algebraic equations using 'solve' [float].  I'd prefer to use 'solve' over 'fsolve', as 'solve' solves my system in about 0.05s, whereas fsolve takes about 5 seconds.  I need to solve the system repeatedly at a different points, so time is important.  I don't know why there is such a large difference in time ... 

I have a few piecewise functions of order 3 to 5.  It solves fine with the other (piecewise) equations, but adding one piecewise function which gives me an error while trying to solve:

Error, (in RootOf) _Z occurs but is not the dependent variable.

I think this is due to solve finding multiple solutions.  Is there a way to limit solve to only real solutions?

Thanks in advance!

How would i go about integrating

(1)/(x^2+2)

 

I know it has to do something with arc tan but it doesnt match up completely what would I be able to do?

1 2 3 4 5 6 7 Page 3 of 8