sand15

1244 Reputation

15 Badges

10 years, 362 days

MaplePrimes Activity


These are answers submitted by sand15

@Teep 

From Optimization/General/Options help page:

depthlimit = posint
Set the maximum depth of the branch-and-bound tree. This option is only used by the Optimization[LPSolve] command for integer programs. 
The default is the maximum of 2 and ceil(3*n/2).
The internal workspace allocated by the integer programming solver depends on the value of depthlimit.  If, during the computation, the workspace is found to be insufficient, an error is issued indicating that depthlimit must be increase
d.

The attached worksheet presents some tracks on a simplified problem (5 jobs and 5 machines):

  1. For this n=26 variable problem the default value of depthlimit is 114 and wasn't large enougth to avoid the

    Error, (in Optimization:-LPSolve) maximal depth, 500, of branch and bound search is too small; use depthlimit option to increase depth

  2. Using depthlimit=1000 returns a solution with performances

    memory used=3.47MiB, alloc change=1.93MiB, cpu time=3.70m, real time=3.71m, gc time=0ns

  3. Using depthlimit=600 returns the same solution with better performances

    memory used=2.21MiB, alloc change=1.62MiB, cpu time=5.10m, real time=5.13m, gc time=0ns
    Which suggests to use only the necessary depthlimit value, no more (which is rethorical)

  4. Using depthlimit=500 returns the same error as with the default depthlimit value

  5. Using again the same depthlimit=500 value but restricting the number of nodes to explore (nodelimit=10^5)
    gives almost the same solution than depthlimit=600 with nodelimit=0 ... but it's  about seven times faster:
    memory used=1.97MiB, alloc change=1.55MiB, cpu time=43.61s, real time=43.67s, gc time=0ns

So I suggest you not to keep increase depthlimit (which penalizes the computational time), but set it to  a value reasonably larger than the default one (182) and increase progressively nodelimit until the  optimal solution no longer evolves.

5 jobs and 5 machines  Some_tracks_5_5.mw   !!! read red text below
5 jobs and 8 machines  Some_tracks_5_8.mw   !!! read red text below

When opening again those same files with Maple 2015 (the version I use) suprious errors appear due to some invisible character in some command blocks.
Here is the (partially) rewritten code for the 5 jobs and 8 machines case 

Some_tracks_5_8_(new).mw

XT_sand15.mw provides a very simple solution.

Nevertheless changing the x range or the tvalue will very likely make this error to appear

Error, (in dsolve/numeric/bvp) Newton iteration is not converging

Despite it is a very classical error for which some recipes do exist to fix it, see dsolve/numeric_bvp/advanced help page and the so-called continuation method, it can be hard to find the correct way to use this trick.
I blindly tried some possibilities but even I can't say any of them gave satisfaction.
Another possibility might be ti initoiate the dsolve process by giving some approximate solution  (search for approsoln in dsolve/numeric/BVP help page).

Generaly this kind of issue cannot be fixed by applying blindly those recpes and the one which is best placed to use them in an enlightened manner is the one who understands the physics underlying the differential system to be solved, i.e., you.

When several quantities have the same range of variation and this range is much greater than the relative variations between these same quantities, there is no choice but to represent the absolute or relative differences in order to highlight the differences.

Q_SEPARATE_sand15.mw

(if this suits you change the vertical label accordingly)

You wrote "i have four equations i want make them be bigger or smaller than zero" which does mean anything.
Do you mean "I want their solutions to be larger or smaller than 0"?
More precisely doyou mean "I want all w, p, chi and beta[1] to be positive or all w, p, chi and beta[1] to be negative" ?

If it is so there is no 6-uple (S1, S2, S3, T1, beta[2], k) such that all w, p, chi and beta[1] have the same sign.
It is indeed very simple toprove that chi*p is always negative, meaning chi and p have different signs:
 

restart

NULL

eq1 := S__1 = sqrt((-beta[1]+sqrt(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2))/beta[2]):

sol := solve(eqs, {chi, p, w, beta[1]})

{chi = -(1/4)*beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)/S__3^2, p = (1/2)*T__1^2*beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)/S__3^2, w = -(1/2)*beta[2]*(S__1^2*S__2^2*T__1^2*k^2-S__1^2*T__1^4*k^2-2*S__2^2*T__1^4*k^2+2*T__1^6*k^2+S__1^2*S__2^2*S__3^2)/S__3^2, beta[1] = -(1/2)*S__1^2*beta[2]-S__2^2*beta[2]}

(1)

eval(chi*p, sol);

-(1/8)*beta[2]^2*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)^2*T__1^2/S__3^4

(2)

 

NULL

 

Download condition-parameters_sand15.mw


If you want to find a 6-uple (chi, w, p, k, beta[1], beta[2]) such that botg S1, S2, S3, T1 are positive look here condition-parameters_2_sand15.mw
 


 

First point: avoid using multiple restart command in your worksheet.

In my answer I deleted all which is before the second restart and focused on this error

p1 := contourplot(P, u=-1..1, v=-1..1, scaling=constrained,
    colorscheme="DivergeRainbow", contours=[seq](x, x=-0.5..0.5,0.05)):
Error, (in plot/iplot2d:-Levels) could not evaluate expression

When you get such a message the first thing to do is to display tha quantity to plot (P) to try and see if it is plottable.

This is not the case in your worksheet because P depends on 6 parameters k1, s1, ..., s5 beyond u and v.
So give them all numeric values and and plot. Illustration below:

restart:

with(plots):

Let's write diff(u(x), x) = f(u(x), v(x)), diff(v(x), x) = g(u(x), v(x)) for the two differential equations.

f := (u,v) -> v*(2*chi*u^2 + p):
g := (u,v) -> -beta[2]*u^5 - 2*chi*u*v^2 + u*p*k^2 - beta[1]*u^3 + u*w:

# i have to change parameter for more simplicity work, so i change the parameter of equation and i use another letter

#k[1]=2*chi,k[2]=p, s[1]=-beta[2], s[2]=2*chi, s[3]=p*k^2, s[4]=beta[1], s[5]=w

f := proc (u, v) options operator, arrow; v*(k[1]*u^2+k[2]) end proc:

g := proc (u, v) options operator, arrow; s[1]*u^5-s[2]*u*v^2+u*s[3]-s[4]*u^3+u*s[5] end proc:

The equilibria:

equilibria := solve({f(u,v)=0, g(u,v)=0}, {u,v},explicit):

The differential equations (not needed in this worksheet)

de1 := diff(u(t),t) = f(u(t),v(t)):
de2 := diff(v(t),t) = g(u(t),v(t)):

PDEtools:-ConservedCurrents({de1, de2}, [u(t), v(t)]):

The conserved quantity

P := -((-s[1]*s[2]*(k[1] + s[2])*u^4/2 + s[2]*(k[1]*s[4] + k[2]*s[1] + 1/2*s[2]*s[4])*u^2 + s[2]*(k[1] + s[2])*(k[1] + s[2]/2)*v^2 + ((-s[3] - s[5])*s[2]^2)/2 + ((3*(-s[3] - s[5])*k[1] - k[2]*s[4])*s[2])/2 + (-s[3] - s[5])*k[1]^2 - k[1]*k[2]*s[4] - k[2]^2*s[1])*(k[1]*u^2 + k[2])^(s[2]/k[1]))/(2*s[2]*(k[1] + s[2])*(k[1] + s[2]/2)):

#Let's take F__1 = 1, F__2 = -1NULL

#F__1, F__2 := 1, -1:

Here are the equilibra now

equilibria:

 

EE := subs({sqrt(-k[1]*k[2])/k[1] = X[1], sqrt(s[2]*(k[1]^2*s[3]+k[1]^2*s[5]+k[1]*k[2]*s[4]+k[2]^2*s[1]))/(s[2]*k[1]) = T[3], (1/2)*sqrt(2)*sqrt((s[4]+sqrt(-4*s[1]*s[3]-4*s[1]*s[5]+s[4]^2))/s[1]) = T[1], (1/2)*sqrt(-(2*(-s[4]+sqrt(-4*s[1]*s[3]-4*s[1]*s[5]+s[4]^2)))/s[1]) = T[2]}, equilibria)

{0 = -T[3], 0 = -X[1]}

(1)

U := v*(u^2*k[1]+k[2])

v*(u^2*k[1]+k[2])

(2)

V := u^5*s[1]-u^3*s[4]-u*v^2*s[2]+u*s[3]+u*s[5]

u^5*s[1]-u^3*s[4]-u*v^2*s[2]+u*s[3]+u*s[5]

(3)

var := u, v:

J := Student:-MultivariateCalculus:-Jacobian([U, V], [var], 'output' = 'matrix'):

LinearAlgebra:-Determinant()

Error, invalid input: LinearAlgebra:-Determinant uses a 1st argument, A (of type `~Matrix`), which is missing

 

J := Student:-MultivariateCalculus:-Jacobian([U, V], [var] = [0, 0], 'output' = 'matrix'):

LinearAlgebra:-Determinant()

Error, invalid input: LinearAlgebra:-Determinant uses a 1st argument, A (of type `~Matrix`), which is missing

 

s__3 := 1; -1; s__5 := 1; -1; k[2] := 1

1

(4)

#det := Determinant(J):    # the determinant
#tra := Trace(J):          # the trace
#dsc := tra^2 - 4*det:     # the discriminant (Delta)
#Eigenvalues(J):           # the eigenvalues

x(t)

x(t)

(5)

diff~(<x(t),y(t)>, t) =~ J . <x(t),y(t)>:
sys := {seq}(%):

ic := [x(0)=1,y(0)=1], [x(0)=-1,y(0)=1], [x(0)=1,y(0)=-1], [x(0)=-1,y(0)=-1]:

DEplot(sys, [x(t),y(t)], t=0..8, [ic], axes=normal, tickmarks=[0,0], labels=["",""], dirfield=[10,10], arrows=comet, color="DarkCyan"):

equilibria:

Plot the phase portrait

p1 := contourplot(P, u=-1..1, v=-1..1, scaling=constrained,
    colorscheme="DivergeRainbow", contours=[seq](x, x=-0.5..0.5,0.05)):

Error, (in plot/iplot2d/levelcurve) could not evaluate expression

 

# What is P?

P;

# Does P contain some undefined quantities other than 'u' and 'v'?

Pind := convert(indets(P, name) minus {u, v}, list);

# P contains 6 unknown quantities and thus cannot be plotted

-(1/2)*(-(1/2)*s[1]*s[2]*(k[1]+s[2])*u^4+s[2]*(k[1]*s[4]+s[1]+(1/2)*s[2]*s[4])*u^2+s[2]*(k[1]+s[2])*(k[1]+(1/2)*s[2])*v^2+(1/2)*(-s[3]-s[5])*s[2]^2+(1/2)*(3*(-s[3]-s[5])*k[1]-s[4])*s[2]+(-s[3]-s[5])*k[1]^2-k[1]*s[4]-s[1])*(u^2*k[1]+1)^(s[2]/k[1])/(s[2]*(k[1]+s[2])*(k[1]+(1/2)*s[2]))

 

[k[1], s[1], s[2], s[3], s[4], s[5]]

(6)

# Correction: give Pind numeric values BEFORE plotting, for instance

eval(P, Pind =~1);
contourplot(eval(P, Pind =~1), u=-1..1, v=-1..1, scaling=constrained, colorscheme="DivergeRainbow");

-(1/6)*(-u^4+(5/2)*u^2+3*v^2-17/2)*(u^2+1)

 

 
 

 

Download Why_cannot_P_be_plotted.mw

What do the regions labelled  TM1, TM2, TM3 are aimed to represent?

Did you mean this: Regions_where_each_TMi_is_the_largest.mw

restart;

with(geometry):

with(StringTools):

interface(worksheetdir):

currentdir(%):

toX := proc(e)
  if e::list then
    cat(
      "\\left(",
      seq( cat(latex(u, 'output' = 'string'), "; "), u in e[1..-2]),
      latex(e[-1], 'output' = 'string'),
      "\\right)"
    )
  else
    latex(e, 'output' = 'string')
  end if:
end proc:

printf("\\documentclass[12pt]{article}\n"):

printf("\\usepackage{amsmath,amssymb}\n"):

printf("\\usepackage{enumitem}\n"):

printf("\\begin{document}\n\n"):

f := x -> (x^2 + 4*x + 7)/(x + 1):

df := simplify(diff(f(x), x)):

cuctri := sort([solve(df = 0, x)], key = evalf):

g := simplify(diff(df, x)):

xcd := rhs(solve([df = 0, g(x) < 0], x)[1]):

xct := rhs(solve([df = 0, 0 < g(x)], x)[1]):

ycd := simplify(f(xcd)):

yct := simplify(f(xct)):

mycd := coordinates(point(A, xcd, ycd)):

myct := coordinates(point(B, xct, yct)):

L := [cat("Let a function be given: $y = ", toX(f(x)), "$."), cat("Its derivative is: $y' = ", toX(df), "$."), cat("The maximum point of the graph  $ ", toX(mycd), "$.")]:

 

printf("\\begin{enumerate}[label=\\arabic*)]\n");

for item in L do

    printf("\\item %s\n", item);

end do;

printf("\\end{enumerate}\n\n");

printf("\\end{document}\n\n");

 

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
\begin{document}

\begin{enumerate}[label=\arabic*)]
\item Let a function be given: $y = {\frac {{x}^{2}+4\,x+7}{x+1}}$.
\item Its derivative is: $y' = {\frac {{x}^{2}+2\,x-3}{ \left( x+1 \right) ^{2}}}$.
\item The maximum point of the graph  $ \left(-3; -2\right)$.
\end{enumerate}

\end{document}

 

 

Download One_way.mw

(Shame there is no example in the corresponding help page about this way to use dualaxisplot)

restart

with(Optimization):

NULL

_local(Pi);

`&Pi;_12` := (0.1455251030e-2*Ce+.5352049476)*(0.369876310e-1+`-`(0.3638127575e-2*Ce))+.8*(-.1671790360+1.121361872*Ce)*(0.1849381518e-1+`-`(0.1819063782e-2*Ce))+`-`(Ce*(0.1849381518e-1+`-`(0.1819063782e-2*Ce)));

(0.1455251030e-2*Ce+.5352049476)*(0.369876310e-1-0.3638127575e-2*Ce)+(-.1337432288+.8970894976*Ce)*(0.1849381518e-1-0.1819063782e-2*Ce)-Ce*(0.1849381518e-1-0.1819063782e-2*Ce)

(1)

`&Pi;_22` := Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(0.1455251030e-2, Ce), .5356096675), Student:-VectorCalculus:-`+`(0.355258312e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.3638127575e-2, Ce)))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(.8, Student:-VectorCalculus:-`+`(-.1184158360, Student:-VectorCalculus:-`*`(1.121361872, Ce))), Student:-VectorCalculus:-`+`(0.1776291535e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce))))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Ce, Student:-VectorCalculus:-`+`(0.1776291535e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce))))));

(0.1455251030e-2*Ce+.5356096675)*(0.355258312e-1-0.3638127575e-2*Ce)+(-0.9473266880e-1+.8970894976*Ce)*(0.1776291535e-1-0.1819063782e-2*Ce)-Ce*(0.1776291535e-1-0.1819063782e-2*Ce)

(2)

`&Pi;_32` := Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(0.1455251030e-2, Ce), .5356038465), Student:-VectorCalculus:-`+`(0.355403838e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.3638127575e-2, Ce)))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(.8, Student:-VectorCalculus:-`+`(-.1179012835, Student:-VectorCalculus:-`*`(1.121361872, Ce))), Student:-VectorCalculus:-`+`(0.1777019161e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce))))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Ce, Student:-VectorCalculus:-`+`(0.1777019161e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce))))));

(0.1455251030e-2*Ce+.5356038465)*(0.355403838e-1-0.3638127575e-2*Ce)+(-0.9432102680e-1+.8970894976*Ce)*(0.1777019161e-1-0.1819063782e-2*Ce)-Ce*(0.1777019161e-1-0.1819063782e-2*Ce)

(3)

S12 := plot(`&Pi;_12`, Ce = 0 .. 0.9e-1, color = [red], labels = ["Ce", "Manufacturer Profit"], labeldirections = ["horizontal", "vertical"], legend = [`#msubsup(mi("Pi"),mi("m"),mn("W"));`]):

`&Pi;_1` := Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.60726413e-1, Ce)), .6173851967), Student:-VectorCalculus:-`+`(0.1849381518e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce)))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.2500000000e-1, Student:-VectorCalculus:-`+`(0.1849381518e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce)))^2)));

(-0.60726413e-1*Ce+.6173851967)*(0.1849381518e-1-0.1819063782e-2*Ce)-0.2500000000e-1*(0.1849381518e-1-0.1819063782e-2*Ce)^2

(4)

`&Pi;_2` := Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.60726413e-1, Ce)), .5929853242), Student:-VectorCalculus:-`+`(0.1776291535e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce)))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.2500000000e-1, Student:-VectorCalculus:-`+`(0.1776291535e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce)))^2)));

(-0.60726413e-1*Ce+.5929853242)*(0.1776291535e-1-0.1819063782e-2*Ce)-0.2500000000e-1*(0.1776291535e-1-0.1819063782e-2*Ce)^2

(5)

`&Pi;_3` := Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.60726413e-1, Ce)), .5932282299), Student:-VectorCalculus:-`+`(0.1777019161e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce)))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.2500000000e-1, Student:-VectorCalculus:-`+`(0.1777019161e-1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(0.1819063782e-2, Ce)))^2)));

(-0.60726413e-1*Ce+.5932282299)*(0.1777019161e-1-0.1819063782e-2*Ce)-0.2500000000e-1*(0.1777019161e-1-0.1819063782e-2*Ce)^2

(6)

S1 := plot(`&Pi;_1`, Ce = 0 .. 0.9e-1, color = [yellow], labels = ["Ce", "Retailer profit"], labeldirections = ["horizontal", "vertical"], legend = [`#msubsup(mi("Pi"),mi("r"),mn("W"));`]):

dualaxisplot(
  display(S1, S2, S3)
  ,
  display(S12, S22, S32)
)

 
 

``

Download All_plots_Combined_sand15.mw


One way is to give rho a numeric value BEFORE solving the ode system, the other one (which I use in the attached file) is to use the dsolve/numeric option 'parameters'.
 

Before doing this I advice you to rewrite the system you want to solve, which is actually a DAE (Differential Algebraic System), as an ODE system (Maple can solve DAE systems but I can't see any reasons for doing so here unless adding unnecessary complexity).
 

Once all this done dsolve is then capable to compute a solution. 
Nevertheless you will see in the attached file that an arbitrary choice of the rho value (I took rho = 1), leads to a singularity at time 0.57: because I have no idea of the values rho might have

(rho is ought to represent the density of Mars atmosphere, something about 20g/m3, but I don't know what are the units you use) 

it's hard to say more about this dicontinuity (real or simple artefact due to unrealistic rho value?).
Nevertheless a quick analysis is provided at the end of this answer.


SimpleMarsEntryAndAeroBrakingModel_sand15.mw



Note that other choices enable computing the solution for arbitrary much larger times, for instance

ans(parameters=[0.1])
                          [rho = 0.1]

display(
  Matrix(2, 3, [seq(odeplot(ans, [t, u], t=0..100, title=typeset(u)), u in unknowns)])
)


Nevertheless I suppose you want to end the simulation when the probe hits the ground, don't you?  
If it is so, let landing_t the time when the probe reaches Mars surface. Given its average radius is 3389.5 Km, landing_t verifies  r(landing_t) = 3389.5. The easiest way to stop the simulation when this latter condition is fullfiled uses the dsolve/numeric 'events' option:

landing_r := 3389.5; # kilometers

ans := dsolve(
         ODESYS
         , numeric
         , method = rkf45
         , maxfun = -1
         , parameters = params
         , events = [[r(t) = landing_r, halt]]
       ):

# Specialize the solution for some given value of rho, here rho=0.1

ans(parameters=[0.1]);
                  [rho = .1]

# initialize the solution procedure for some time a priori larger than
# the expected landing time:

ans(100):

# Catch the value of landing_t (meaning the value of t which fires the event)

landing_t := ans(eventfired=[1])[]
Warning, cannot evaluate the solution further right of 264.44373, event #1 triggered a halt
                   landing_t := 11.9098649021394

Next do the plots from 0 to landing_t.
For more details download the worksheets at the end of this answer.


By the way: shouldn't  g be equal to the gravitational acceleration on Mars (about 3.73 m/s2 ... you seem to get a value of about 12.64 m/s2)?


Last but not least: the worksheet below provides a short analysis of the emergence of a singularity. From this analysis it is clear that the right hand side of the d𝜙(t)/dt equation takes an infinite value for some finite time and that comes from (cos(𝛾(t)) = 0 at this same time (cos(𝛾(t)) is present at the denominator of d𝜙(t)/dt equation).
This means the flight path angle 𝛾(t) is equal to -𝜋/2 at finite time (vertical drop)... which should not be possible when there is friction.
My advice: check your equations, data and units.

singularity_analysis_sand15.mw   see also   capturing_cos(gamma(t))=0.mw

I guess someone else could interpret your question differently and provide another answer.
Whatever here is mine: My_interpretation.mw (file can't be uploaded)

-0.06888275721

You write "I want to choose A to obtain the smallest absolute value of Em, preferably ~ -0.00005".
I suppose you want to say "I want to choose A to obtain the smallest absolute value of Em, preferably ~ +0.00005", don't you?

Whatever, Em is strctly negative for A > 0 and its limit when A goes to 0 from the right is -0.06888275721, which means that your requirement cannot be met.

Note that for A = 0 we have  E(𝜐) = C𝜐2 + -0.06888275721 which immediatly gives the value of C... but the fitted model is unacceptable has shown in the attached file.

At the very end I'm leaning to consider your problem is not correctly posed and I suggest you to consider carefully what you want to do.
ML_sand15.mw

for i2 varying from 0 to 1

doen't nmean anything at all as the 
Error, controlling variable of for loop must be a name or sequence of 2 names
says: between for and from you must have only one name (here you have i2 and varying).

Given the past worksheets you posted I don't even understand how you can have written  (sorry if I feel that rude) such a stupid  thing?
A few correct syntaxes are

for i2 from 0 to 1 do
...
end do:

for i2 from 0 to 1 by 1/3 do
...
end do:

# etc

Note that the first syntax seems quite stupid to me in your context:

# with K2 = 0.1968052257

for i2 from 0 to 1 do
  if i2 > K2 then 
    do_something
  else
    do_something_else
  endif:
end do:

because the counter (here i2) being an integer unless "by some_value" is specified, it takes only the values i1=0 and i2=1. So a simpler operation is 

Do_this := i2 -> piecewise(i2 > K2, do_something, do_something_else)

Nothing of what you try to achieve is clear to me.
Moreover, if you are not capable to manage correctly the 2D input document mode, just as I can't neither, use the 1D input worksheet mode (your file contains a lot of breaks which generate errors (yout for anf if structures do not end correctly).

Whatever... look to the attached file to see how to write something error free A_no_error_worksheet_sand15.mw and try to use it contents to formulate correctly your problem (which I repeat I do not understand).

(done with Maple 2015 but should work the same with Maple 2018)
One_way_sand15.mw   (read carefully the last comment in thiw worksheet)


Proceed the same way for the 3D plots by replacing p1_final by p1 in C11 and p2_final by p2 in C12.

Note: If you do some browsing on this same site you should be able to find several questions about the same subject.
@acer already gave a lot of answers too [moderator: eg. here, here, here]
[moderator: If you need to export the 3D plot with colorbar in such an old Maple version then see also here.]

[moderator: colorbars received direct support for 3D plotting commands in Maple 2024.]

restart;
n := 0:
L := []:

for a from 3 to 100 do
    for b from 3 to a do
        c2 := a^2 - a*b + b^2;
        c := isqrt(c2);
        if c^2 = c2 then
            if c < a + b and a < b + c and b < c + a then
                if igcd(a, b, c) = 1 then
                    x2 := (-a^2 + b^2 + c^2)/2;
                    y2 := (a^2 - b^2 + c^2)/2;
                    z2 := (a^2 + b^2 - c^2)/2;
                    if 0 < x2 and 0 < y2 and 0 < z2 then
                        # One way
                        S := [sqrt(x2), sqrt(y2), sqrt(z2)];
                        S := S[sort(evalf(S), output=permutation)];
                        x := S[1]; 
                        y := S[2]; 
                        z := S[3];
                        n := n + 1;
                        L := [op(L), [x, y, z, sqrt(x^2 + y^2), sqrt(y^2 + z^2), sqrt(x^2 + z^2)]];
                    end if;
                end if;
            end if;
        end if;
    end do;
end do;

n;
L;


Why was sort([sqrt(x2), sqrt(y2), sqrt(z2)]) ineffective?
Look at this

S0 := [6*sqrt(110), 2*sqrt(610), 3*sqrt(649)];
sort(S0, `>`)
Error, invalid input: a numeric list is expected for sort method ``>``

# To understand this "failure" look at this 
if S0[1] > S0[2] then "yes" else "no" end if;
Error, cannot determine if this expression is true or false: 2*610^(1/2) < 6*110^(1/2)

So sort, which vasically uses an if structure, simply doesn't know how to compare these two non rational numbers.

Note that is can do it:

is(S0[1] > S0[2]);
                             true
is(S0[1] < S0[2]);
                             false

 

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