# Toolbox Questions and PostsToolbox Questions and Posts Feed

These are Posts and Questions associated with the product, Toolbox

July 16 2015
0 5

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

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

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.

### How to insert a plot in word with maple functions ...

April 30 2015
0 1

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,"%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.

### How to add Maple environment to Maple IDE?...

April 22 2015
1 1

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

|\^/| Maple 18 (X86 64 WINDOWS)
._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2014
<____ ____> 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

### output display in matlab...

April 14 2015
1 5

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:

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

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

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

### Analysis of Ergodic Billiards...

December 02 2014
1 2

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

### How to simulate "Inelastic collision" on maple?...

November 22 2014
0 0

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

### Solve the Coefficient of ODES ...

November 10 2014
0 1

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

### Packing of circles: touchstone for global optimize...

August 13 2014 Maple Toolbox
3
1

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.

### How to solve this problem in Maple？...

August 01 2014
0 3

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
>

### Restart Maple memory except variable?...

June 06 2014
0 2

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?

### Maple Toolbox for Matlab: Segmentation Violation?...

June 04 2014
0 13

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):
[ 1] 0x00007f3c962b14b2 /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00521394
[ 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
[ 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
[ 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.

### May Live Webinars...

0
0

Maplesoft regularly hosts live webinars on a variety of topics. Below you will find details on some upcoming webinars we think may be of interest to the MaplePrimes community.  For the complete list of upcoming webinars, visit our website.

Hollywood Math (with more new examples!)

Over its storied and intriguing history, Hollywood has entertained us with many mathematical moments in film. John Nash in “A Beautiful Mind,” the brilliant janitor in “Good Will Hunting,” the number theory genius in “Pi,” and even Abbott and Costello are just a few of the Hollywood “mathematicians” that come to mind.

Although the widespread presentation of mathematics on the silver screen is not always entirely accurate, it does serve as a great introduction to the study of mathematics in general. During this webinar Maplesoft will present a number of examples of mathematics in film. See relevant, exciting examples that you can use to engage your students.At the end of the webinar you’ll be given an opportunity to download an application containing all of the Hollywood examples that we demonstrate.

Applications of Symbolic Computation in Control Design

You may already use Maple and/or MapleSim within your organization to solve various problems, but did you know that they have capabilities for control design as well? In one of our upcoming featured webinars for this month, we will explore the Control Design toolbox including the ability to extract symbolic equations of plant models, perform symbolic linearization, design symbolic controllers, and generate very fast code for HIL testing.

The following examples will be demonstrated:

• PID Control

• LQR, Kalman filter design

• Gain scheduling

• Feedback linearization

### System of equations solve, solutions may be lost. ...

March 19 2014
0 4

Hi MaplePrime-ers!

I've been using the Maple(17) toolbox in Matlab(2012b) to quickly enumerate systems of equations by: (i) solving them symbolically, (ii) using unapply to make them functions, (iii) then supplying the points (driver equations) to get the system solution.  Speed is a must, because there may be 3 million+ systems to solve.  Symbolics is also very important because I am evaluating topology, so the structure of the equations may change, and therefore a functional approach will not work.

I have had success (seen in the first code snippet).  I would like similiar behaviour in the second code snippet, but sometimes I get 'solutions may be lost' as an error message,  or 'Error, (in unapply) variables must be unique and of type name'

The system of equations include:  Linear equations, 5th order polynomials, absolute functions, and pieceiwse functions.

Here is code with a topology that solves:

#Interconnection Equations
eq2[1] := FD_T + EM2_T = 0;
eq2[2] := ICE_T + GEN_T = 0;
eq2[3] := EM2_A + GEN_A + BAT_A = 0;
eq2[4] := -FD_W + EM2_W = 0;
eq2[5] := -ICE_W + GEN_W = 0;
eq2[6] := -EM2_V + GEN_V = 0;
eq2[7] := -EM2_V + BAT_V = 0;

#ICE
eq_c[1] := ICE_mdot_g=((671.5) + (-21.94)*ICE_T + (0.1942)*ICE_W + (0.5113)*ICE_T^2 + (-0.01271)*ICE_T*ICE_W + ( -0.0008761)*ICE_W^2 + (-0.006071)*ICE_T^3 + (9.867e-07)*ICE_T^2*ICE_W + (5.616e-05)*ICE_T*ICE_W^2 + (1.588e-06)*ICE_W^3 + (3.61e-05)*ICE_T^4 + (8.98e-07)*ICE_T^3*ICE_W + (-2.814e-07)*ICE_T^2*ICE_W^2 + (-8.121e-08)*ICE_T*ICE_W^3 + ( -8.494e-08 )*ICE_T^5 + (-2.444e-09)*ICE_T^4*ICE_W + (-9.311e-10)*ICE_T^3*ICE_W^2 + ( 5.835e-10)*ICE_T^2*ICE_W^3 ) *1/3600/1000 * ICE_T * ICE_W;

#BAT
eq_c[2] := BAT = 271;

#EM2
EM2_ReqPow_eq := (-148.3) + (4.267)*abs(EM2_W) + (12.77)*abs(EM2_T) + (-0.0364)*abs(EM2_W)^2 + ( 1.16)*abs(EM2_W)*abs(EM2_T) + (-0.258)*abs(EM2_T)^2 + ( 0.0001181)*abs(EM2_W)^3 + (-0.0005994)*abs(EM2_W)^2*abs(EM2_T) + ( 0.0001171)*abs(EM2_W)*abs(EM2_T)^2 + (0.001739 )*abs(EM2_T)^3 + (-1.245e-07 )*abs(EM2_W)^4 + ( 1.2e-06)*abs(EM2_W)^3*abs(EM2_T) + ( -1.584e-06)*abs(EM2_W)^2*abs(EM2_T)^2 + ( 4.383e-07)*abs(EM2_W)*abs(EM2_T)^3 + (-2.947e-06)*abs(EM2_T)^4;
eq_c[3] := EM2_P = piecewise( EM2_T = 0, 0, EM2_W = 0, 0, EM2_W*EM2_T < 0,-1 * EM2_ReqPow_eq, EM2_ReqPow_eq);
eq_c[4] := EM2_A = EM2_P/EM2_V;

#GEN
GEN_ReqPow_eq:= (-5.28e-12) + ( 3.849e-14)*abs(GEN_W) + (-71.9)*abs(GEN_T) + (-1.168e-16)*abs(GEN_W)^2 +(1.296)*abs(GEN_W)*abs(GEN_T) + (2.489)*abs(GEN_T)^2 + (1.451e-19)*abs(GEN_W)^3 + (0.0001326)*abs(GEN_W)^2*abs(GEN_T) + (-0.008141)*abs(GEN_W)*abs(GEN_T)^2 + (-0.004539)*abs(GEN_T)^3 +(-6.325e-23)*abs(GEN_W)^4 + (-2.091e-07)*abs(GEN_W)^3*abs(GEN_T) + ( 3.455e-06)*abs(GEN_W)^2*abs(GEN_T)^2 + ( 2.499e-05)*abs(GEN_W)*abs(GEN_T)^3 + (-5.321e-05)*abs(GEN_T)^4;
eq_c[5] := GEN_P = piecewise( GEN_T = 0, 0, GEN_W = 0, 0, GEN_W*GEN_T < 0,-1 * GEN_ReqPow_eq, GEN_ReqPow_eq);
eq_c[6] := GEN_A = GEN_P/GEN_V;

#ASSUMPTIONS
assume(BAT_V::nonnegative);
assume(FD_W::nonnegative);

#FINAL EQUATIONS

sys_eqs2 := convert(eq2,set) union {eq_c[1],eq_c[2],eq_c[3],eq_c[4],eq_c[5],eq_c[6]};

#Selecting which variables to solve for:

drivers2:= { ICE_T,ICE_W,FD_T,FD_W};
symvarnames2:=select(type,indets(convert(sys_eqs2,list)),name);
notdrivers2:=symvarnames2 minus drivers2;

#Symbolic solve

sol2:=solve(sys_eqs2,notdrivers2) assuming real:
symb_sol2:=unapply(sol2,convert(drivers2,list)):

#Enumerate (there will generally be about 40, not 6)

count := 0;
for i1 from 1 to 40 do
for i2 from 1 to 40 do
for i3 from 1 to 40 do
for i4 from 1 to 40 do
count := count + 1;
solsol2(count) := symb_sol2(i1,i2,i3,i4);
od;
od;
od;
od;
count;

This works great!  I would like simliar output in my second code snippet, but this time with more inputs to symb_sol.  However, if I try and change the interconnection equations a little, and add a piecewise function, and another driver... (differences in bold)

#Interconnection Equations
eq1[1] := FD_T+EM2_T = 0;
eq1[2] := ICE_T+GBb_T = 0;
eq1[3] := GEN_T+GBa_T = 0;
eq1[4] := EM2_A+GEN_A+BAT_A = 0;
eq1[5] := -FD_W+EM2_W = 0;
eq1[6] := -GEN_W+GBa_W = 0;
eq1[7] := -ICE_W+GBb_W = 0;
eq1[8] := -EM2_V+GEN_V = 0;
eq1[9] := -EM2_V+BAT_V = 0;

#ICE
eq_c[1] := ICE_mdot_g=((671.5) + (-21.94)*ICE_T + (0.1942)*ICE_W + (0.5113)*ICE_T^2 + (-0.01271)*ICE_T*ICE_W + ( -0.0008761)*ICE_W^2 + (-0.006071)*ICE_T^3 + (9.867e-07)*ICE_T^2*ICE_W + (5.616e-05)*ICE_T*ICE_W^2 + (1.588e-06)*ICE_W^3 + (3.61e-05)*ICE_T^4 + (8.98e-07)*ICE_T^3*ICE_W + (-2.814e-07)*ICE_T^2*ICE_W^2 + (-8.121e-08)*ICE_T*ICE_W^3 + ( -8.494e-08 )*ICE_T^5 + (-2.444e-09)*ICE_T^4*ICE_W + (-9.311e-10)*ICE_T^3*ICE_W^2 + ( 5.835e-10)*ICE_T^2*ICE_W^3 ) *1/3600/1000 * ICE_T * ICE_W;

#BAT
eq_c[2] := BAT = 271;

#EM2
EM2_ReqPow_eq := (-148.3) + (4.267)*abs(EM2_W) + (12.77)*abs(EM2_T) + (-0.0364)*abs(EM2_W)^2 + ( 1.16)*abs(EM2_W)*abs(EM2_T) + (-0.258)*abs(EM2_T)^2 + ( 0.0001181)*abs(EM2_W)^3 + (-0.0005994)*abs(EM2_W)^2*abs(EM2_T) + ( 0.0001171)*abs(EM2_W)*abs(EM2_T)^2 + (0.001739 )*abs(EM2_T)^3 + (-1.245e-07 )*abs(EM2_W)^4 + ( 1.2e-06)*abs(EM2_W)^3*abs(EM2_T) + ( -1.584e-06)*abs(EM2_W)^2*abs(EM2_T)^2 + ( 4.383e-07)*abs(EM2_W)*abs(EM2_T)^3 + (-2.947e-06)*abs(EM2_T)^4;
eq_c[3] := EM2_P = piecewise( EM2_T = 0, 0, EM2_W = 0, 0, EM2_W*EM2_T < 0,-1 * EM2_ReqPow_eq, EM2_ReqPow_eq);
eq_c[4] := EM2_A = EM2_P/EM2_V;

#GEN
GEN_ReqPow_eq:= (-5.28e-12) + ( 3.849e-14)*abs(GEN_W) + (-71.9)*abs(GEN_T) + (-1.168e-16)*abs(GEN_W)^2 +(1.296)*abs(GEN_W)*abs(GEN_T) + (2.489)*abs(GEN_T)^2 + (1.451e-19)*abs(GEN_W)^3 + (0.0001326)*abs(GEN_W)^2*abs(GEN_T) + (-0.008141)*abs(GEN_W)*abs(GEN_T)^2 + (-0.004539)*abs(GEN_T)^3 +(-6.325e-23)*abs(GEN_W)^4 + (-2.091e-07)*abs(GEN_W)^3*abs(GEN_T) + ( 3.455e-06)*abs(GEN_W)^2*abs(GEN_T)^2 + ( 2.499e-05)*abs(GEN_W)*abs(GEN_T)^3 + (-5.321e-05)*abs(GEN_T)^4;
eq_c[5] := GEN_P = piecewise( GEN_T = 0, 0, GEN_W = 0, 0, GEN_W*GEN_T < 0,-1 * GEN_ReqPow_eq, GEN_ReqPow_eq);
eq_c[6] := GEN_A = GEN_P/GEN_V;

#GB
FiveSpeedGearbox_R := proc(ig)
local i ,eq;
i[1]:=3.32;
i[2]:=2;
i[3]:=1.36;
i[4]:=1.01;
i[5]:=0.82;
eq:= piecewise(ig=1,i[1],ig=2, i[2],ig=3,i[3],ig=4,i[4],ig=5,i[5],1);
return eq(ig);
end proc;

eq_c[7] := GBb_T = -1/GB_R * GBa_T;
eq_c[8] := GBb_W = GB_R * GBa_W;
eq_c[9] := GB_R = FiveSpeedGearbox_R(ig);

#System Equations
sys_eqs := convert(eq1,set) union convert(eq_c,set);

#Solve for variables
symvarnames:=select(type,indets(convert(sys_eqs,list)),name);
drivers:= {ig, ICE_T,ICE_W,FD_T,FD_W};
not_drivers := symvarnames minus drivers;

#Assumptinons

assume(BAT_V::nonnegative);
assume(FD_W::nonnegative);

sol:=(solve(sys_eqs,not_drivers) assuming real);

symb_sol:=unapply(sol,convert(drivers,list)): ---> Error, (in unapply) variables must be unique and of type name

Subsequent parts don't work...

count := 0;
for i1 from 1 to 40 do
for i2 from 1 to 40 do
for i3 from 1 to 40 do
for i4 from 1 to 40 do
for i5 from 1 to 40 do
count := count + 1;
solsol2(count) := symb_sol2(i1,i2,i3,i4,5);
od;
od;
od;
od;
od;
count;

While running the last line sol:, 1 of 2 things will happen, depending on the solver. Maple17 will take a long time (30+ minutes) to solve, then report nothing, or sol will solve, but will report "some solutions have been lost".

Afterwards, evaluating symb_sol(0,0,0,0,0) will return a viable solution (real values for each of the variables).  Whereas evaluating symb_sol(0,X,0,0,0), where X <> 0, will return and empty list [].

Does anyone know how to (i) speed up the symbolic solve time?  (ii) Return ALL of the solutions?

Thanks in advance for reading this.  I've really no idea why this isn't working.  I've also attached two worksheets with the code: noGB.mw   withGB.mw

### MapleSim 6.4 is now available...

5
3

MapleSim 6.4 includes more powerful tools for creating custom components, performance enhancements, and enhancements to the model generators for Simulink® and FMI.

We have also made important updates to the MapleSim Control Design Toolbox. This toolbox now offers a more complete set of algorithms for PID control, new commands for computing closed-loop transfer functions, and numerous improvements to existing commands. These enhancements allow engineers to design a greater variety of controllers and controller-observer systems while taking advantage of the greater flexibility and analysis options available through the use of symbolic parameters.

eithne

### Global Optimization - XYZ problem...

February 05 2014
0 4

Data.xlsx

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

 1 2 3 4 5 6 7 Last Page 1 of 10
﻿