acer

32450 Reputation

29 Badges

19 years, 364 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@jalal That was not clear to me from the original Question. Thanks.

You can apply handler procedure F to either the M or the Sol entries in your Tabulate calls. Below, I do it for both. It's your choice.

Systmes_Idea_ac2.mw

restart

L := [seq(S[i], i = 1 .. 12)]

sys_1 := [x+y = 2, x-y = 0]

sys_2 := [x+2*y = 3, x-3*y = -1]

sys_3 := [x+4*y = -3, x-3*y = -1]

sys_4 := [x+2*y = 3, x-3*y = 3]

sys_5 := [x-2*y = 3, x-3*y = -1]

sys_6 := [x+2*y = 7, x-3*y = -1]

sys_7 := [x+2*y = 8, x-3*y = -1]

sys_8 := [x+2*y = 9, x-3*y = -1]

sys_9 := [x+2*y = 10, x-3*y = -1]

sys_10 := [x+2*y = -3, x-3*y = -1]

sys_11 := [x+2*y = -4, x-3*y = -1]

sys_12 := [x+2*y = -5, x-3*y = -1]

M := [seq({(eval(cat(sys_, i)))[]}, i = 1 .. 12)]

[{x-y = 0, x+y = 2}, {x-3*y = -1, x+2*y = 3}, {x-3*y = -1, x+4*y = -3}, {x-3*y = 3, x+2*y = 3}, {x-3*y = -1, x-2*y = 3}, {x-3*y = -1, x+2*y = 7}, {x-3*y = -1, x+2*y = 8}, {x-3*y = -1, x+2*y = 9}, {x-3*y = -1, x+2*y = 10}, {x-3*y = -1, x+2*y = -3}, {x-3*y = -1, x+2*y = -4}, {x-3*y = -1, x+2*y = -5}]

F := proc (L::(({list, set})(equation))) local i; nprintf(`#%a;`, subs("\`\`" = "", convert(eval(('Typesetting:-Typeset')(('piecewise')(seq(op([``, L[i]]), i = 1 .. nops(L))))), `global`))) end proc

Sol := map(proc (sys) options operator, arrow; solve(sys, {x, y}) end proc, M)

[{x = 1, y = 1}, {x = 7/5, y = 4/5}, {x = -13/7, y = -2/7}, {x = 3, y = 0}, {x = 11, y = 4}, {x = 19/5, y = 8/5}, {x = 22/5, y = 9/5}, {x = 5, y = 2}, {x = 28/5, y = 11/5}, {x = -11/5, y = -2/5}, {x = -14/5, y = -3/5}, {x = -17/5, y = -4/5}]

DocumentTools:-InsertContent(DocumentTools:-Layout:-Worksheet(subs("centred" = "left", DocumentTools:-Tabulate(Matrix(4, 3, proc (i, j) options operator, arrow; `≡`(L[3*i-3+j], F(M[3*i-3+j])) end proc), width = 120, alignment = center, color = blue, fillcolor = "AliceBlue", output = XML))))

`≡`(S[1], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("0",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("2",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[2], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[3], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("4",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[4], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[5], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[6], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("7",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[7], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("8",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[8], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("9",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[9], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("10",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[10], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[11], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("4",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[12], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("3",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("+",mathcolor = "blue"),mn("2",mathcolor = "blue"),mo("⁢",mathcolor = "blue"),mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("−",mathcolor = "blue"),mn("5",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

 

Solutions

DocumentTools:-InsertContent(DocumentTools:-Layout:-Worksheet(subs("centred" = "left", DocumentTools:-Tabulate(Matrix(4, 3, proc (i, j) options operator, arrow; `≡`(L[3*i-3+j], F(Sol[3*i-3+j])) end proc), width = 120, alignment = center, color = blue, fillcolor = "LightYellow", output = XML))))

 

`≡`(S[1], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("1",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[2], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("7",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("4",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[3], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("13",mathcolor = "blue"),mn("7",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("2",mathcolor = "blue"),mn("7",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[4], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("3",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("0",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[5], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("11",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("4",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[6], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("19",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("8",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[7], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("22",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("9",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[8], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("5",mathcolor = "blue"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mn("2",mathcolor = "blue"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[9], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("28",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mfrac(mn("11",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[10], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("11",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("2",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[11], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("14",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("3",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

`≡`(S[12], `#mfenced(mtable(mtr(mtd(mrow(mi("x",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("17",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none())),mtr(mtd(mrow(mi("y",mathcolor = "blue"),mo("=",mathcolor = "blue"),mo("&uminus0;",mathcolor = "blue"),mfrac(mn("4",mathcolor = "blue"),mn("5",mathcolor = "blue"),mathcolor = "blue",linethickness = "1"))),mtd(none()))),open = mo("{",mathcolor = "blue"),close = mo("",mathcolor = "blue"))`)

 

 

Systmes_Idea_ac2.mw

It's now a Post, rather than a Question. (I changed your link)

Your sentence, "The function “add” (a built-in function with special evaluation rules) is intended to be used on sequences" is charged with fuzzy inaccuracy.

It happens that add can work on an expression sequence. But it is not "intended" that such is any kind of preferred usage. Passing expression sequences as arguments to procedure calls is a more generally ruinous habit, and would lead to far more mistakes.

Don't get into the habit of invoking add(S) where S is an expression sequence, when you could instead use the sane add([S]) call. Much more of the time you'll run into trouble elsewhere when you mistakenly try and pass sequences to procedure calls and they get flattened.

nb. If S is an expression sequence then it is uniquified in Maple's stored memory, and construction of the list [S] only increases internal memory use of the thin wrapper of the list structure -- it does not double the memory use. So constructing [S] from S is not very memory-inefficient.

Thus there is no reason to pass a scalar to add by mistake, because you never have to pass it a bare expression sequence.

And the behavior of add to work on operands of a scalar should therefore not be problematic. It's only problematic if you follow the poor strategy of passing bare expression sequences to add.

Someone else might want the behaviour of add's adding operands of a scalar expression, and mistakes than ensue because someone else ill-advisedly passes bare expression sequences to add is not a decent justification for removing the former functionality.

That's my opinion, but I've supplied a rationale for it. I think that add's acceptance of bare expression sequences is more of a design mistake than is add's handling of scalar expression's operands.

@C_R I'm not sure that ::evaln procedure parameter spec would always act as you were expecting. There are a few Constants names that would require other handling; assuming that you are just trying to avoid having to always enter the single left-quotes and so manually form the actual names yourself.

convert(..,name) might be more along the lines of what you wanted. (The ::uneval is optional...)

restart;

GetDef := proc(x::evaln) uses ScientificConstants;
            ((evalf*GetUnit)@Constant)(x);
          end proc:

GetDef(E[h]);

0.4359744650e-17*Units:-Unit(J)

GetDef(mu[d]/mu[e]);

Error, illegal use of an object as a name

GetDef(A[r](e));

Error, (in ScientificConstants:-Constant) expecting a name for 1st argument, got A[r](e)

restart;

GetDef := proc(x::uneval) uses ScientificConstants;
            ((evalf*GetUnit)@Constant)(convert(x,name));
          end proc:

GetDef(E[h]);

0.4359744650e-17*Units:-Unit(J)

GetDef(mu[d]/mu[e]);

-0.4664345535e-3

GetDef(A[r](e));

0.5485799091e-3

A,E,r,e,d,mu := 1,1,1,1,1,1:

GetDef(E[h]);

0.4359744650e-17*Units:-Unit(J)

GetDef(mu[d]/mu[e]);

-0.4664345535e-3

GetDef(A[r](e));

0.5485799091e-3

Download getdef_ex.mw

@C_R I don't personally like Equation Labels (even more than I don't care for alias). But I'm glad that the system is flexible and allows for differing styles of programmatic flow.

Here below is an example of the zeal for replacing assignments with Equation Labels taken too far. It gets rid of the rhs calls. Please take it in the intended spirit of friendliness. (The world seems to need such, right now.) There's a balance somewhere, where a non-Maple reader can understand more of the presentation.

restart

with(Units:-Simple); with(ScientificConstants); Units:-UseUnit(W/m^2)

T__0 := `#msub(mi("T"),mn("0"));`

 

sigma = (evalf*GetUnit)(Constant(sigma))

sigma = 0.5670366658e-7*Units:-Unit(kg/(s^3*K^4))

(1)

T__0 = 293*Unit('K'), T = 500*Unit('K')

`#msub(mi("T"),mn("0"));` = 293*Units:-Unit(K), T = 500*Units:-Unit(K)

(2)

E = sigma*T^4

E = sigma*T^4

(3)

`ΔE` = eval(E, E = sigma*T^4)-(eval(E, eval(E = sigma*T^4, T = T__0)))

`ΔE` = T^4*sigma-sigma*`#msub(mi("T"),mn("0"));`^4

(4)

simplify(`ΔE` = T^4*sigma-sigma*`#msub(mi("T"),mn("0"));`^4)

`ΔE` = sigma*(T^4-`#msub(mi("T"),mn("0"));`^4)

(5)

eval(`ΔE` = sigma*(T^4-`#msub(mi("T"),mn("0"));`^4), [sigma = 0.5670366658e-7*Units:-Unit(kg/(s^3*K^4)), `#msub(mi("T"),mn("0"));` = 293*Units:-Unit(K), T = 500*Units:-Unit(K)])

`ΔE` = 3126.070258*Units:-Unit(W/m^2)

(6)

NULL

Download roman_in_subscript_example_ac2.mw

On a more serious note, I think that,
    (evalf*GetUnit)(Constant(sigma))
is somewhat nice, ie. without too many instance of "sigma". It's the only actual improvement I might have had for your example.

ps. I wish that the Mapleprimes inline worksheet renderer did a better job with Equation Labels, leaving them right-aligned as in the actual Maple GUI.

@C_R So, for this particular example an assignment can serve in lieu of alias. That's all I was trying to convey.

I made some other stylistic changes, not because I think it's better, but just for fun.
i) If one has Eq 2 E=sigma*T^4 at hand then it can be used for Eq 3.
ii) UseUnit makes the unit-combining on target, though you might not want it elsewhere.
iii) 2D Input of 2-argument eval is a choice.

restart

with(Units:-Simple); with(ScientificConstants); Units:-UseUnit(W/m^2)

T__0 := `#msub(mi("T"),mn("0"));`

 

sigma = (evalf*GetUnit)(Constant(sigma))

sigma = 0.5670366658e-7*Units:-Unit(kg/(s^3*K^4))

(1)

E = sigma*T^4

E = sigma*T^4

(2)

`ΔE` = simplify(rhs((E = sigma*T^4)-(eval(E = sigma*T^4, T = T__0))))

`ΔE` = sigma*(T^4-`#msub(mi("T"),mn("0"));`^4)

(3)

params := [sigma = 0.5670366658e-7*Units:-Unit(kg/(s^3*K^4)), T__0 = 293*Unit('K'), T = 500*Unit('K')]

eval(`ΔE` = sigma*(T^4-`#msub(mi("T"),mn("0"));`^4), params)

`ΔE` = 3126.070258*Units:-Unit(W/m^2)

(4)

``

Download roman_in_subscript_example_ac.mw

@Mapleliquid As I wrote before, you cannot be directly using RGB since that requires three layers, ie. here, three matrices or sets of data.

And you only have a single Matrix whose number of entries matches the number of grid points in the plot.

So (instead of RGB) I have used your single Matrix of data can be used to specify the HUE of an HSV colorspace.

Note that in my second example I used the HSVtoRGB command from the ColorTools package. That's why I scaled the 0.0..1.0 values (from FitIntensity) by 360, like degrees.

The GUI's plot renderer can attempt its own rescaling of data, but it does well/best with just the 0.0..1.0 range. But it gets into numeric difficulty if the data is scaled too far from that; I happened to use the 0..360 scaled data (which my second example needs) for both approaches, since the GUI could handle that.

So, you could the 0.0..1.0 range for the first method I showed, and the 0..0..360.0 range for only the second. Here that is:  Plot1_ac2.mw

@Andiguys Is this the kind of effect you're after?

restart

r := proc (Pc) options operator, arrow; theta-upsilon*(Pu-Pc) end proc

A := (2*Pu*upsilon^2*U[0]-epsilon*(2*beta*k*lambda*tau0*upsilon*U[0]+2*Cm*beta*upsilon*U[0]-Cm*epsilon*lambda*upsilon+Cr*epsilon*lambda*upsilon-Pu*epsilon*lambda*upsilon-U*epsilon*lambda*upsilon-2*beta*k*lambda*tau0-epsilon*k*lambda*upsilon+2*epsilon*lambda*upsilon*w+2*a*upsilon*U[0]+epsilon*lambda*theta-2*Cm*beta-2*a)*upsilon/(-2*epsilon^2*lambda*upsilon+4*beta*upsilon*U[0]-4*beta)-2*theta*upsilon*U[0]-upsilon*Pu+U*upsilon-w*upsilon+theta)/(2*upsilon*(upsilon*U[0]-1)) >= 0

B := r(Pc) >= 0

DATA_1 := [Cm = 15000, U = 1000, U[0] = 50, Cr = 1000, w = 2000, a = 60000, beta = .8, lambda = .9, tau0 = .4, k = 20000, epsilon = .1]

E := eval(A, DATA_1)

F := eval(B, DATA_1)

solve(eval({E, F}, [Pu = 800, theta = 30000]), [upsilon, Pc])

[[upsilon < 0., Pc < 400.*(2.*upsilon-75.)/upsilon], [upsilon < 0., Pc = 400.*(2.*upsilon-75.)/upsilon], [upsilon = 0.9981054824e-2, -3004894.341 <= Pc], [upsilon < 0.2000000000e-1, 0.9981054824e-2 < upsilon, Pc = 400.*(2.*upsilon-75.)/upsilon], [upsilon < 0.2000000000e-1, 0.9981054824e-2 < upsilon, 400.*(2.*upsilon-75.)/upsilon < Pc], [upsilon = 0.2000114548e-1, -1499114.094 <= Pc], [upsilon < 0.2000225025e-1, 0.2000114548e-1 < upsilon, Pc = 400.*(2.*upsilon-75.)/upsilon], [upsilon < 0.2000225025e-1, 0.2000114548e-1 < upsilon, 400.*(2.*upsilon-75.)/upsilon < Pc], [upsilon = 37.57325452, 1.559716328 <= Pc], [37.57325452 < upsilon, Pc = 400.*(2.*upsilon-75.)/upsilon], [37.57325452 < upsilon, 400.*(2.*upsilon-75.)/upsilon < Pc]]


Download Q3_acc.mw

@C_R I have the same philosophy regarding late replacement of numeric values, etc. But I almost never use alias, and your short example can also be done using assignment.

I can think of other examples in which your particular requirement to have T__0 be directly the same as the type-set-blob would be easier with alias. But I wondered if you had one such at hand. (I can think of a few, but I don't know which might be like yours, as yet unstated.)

Please upload and attach code that produces a 3D plot of the structure you want, as well as the Matrix representing the color.

You can use the green up-arrow in the Mapleprimes editor to upload and attach a .mw worksheet file.

It's not so useful to provide a mere image of code that does the opposite of what you want to do. At the very least tell us which plotting command you want to use, and what arguments and options you're passing to it.

@C_R Why do you "have" to use alias, as opposed to assignment?

(I guess that I don't know what all your scenarios are for using this.)

Please put followups on these examples here, not in wholly separate new Questions threads.

Duplicate Questions get flagged as such and then may be deleted.

Is your newer material something that would be better as a followup Comment/Reply/addition to your earlier Post? Or something for which you could better use the Branch button from your earlier posting, so that the two automatically get cross-reference links added by the system.

@C_R The OP has expressed concern with the GUI launch time. He's written that that is an "overall" concern because of some need for multiple launches.

There was no specific mention by the OP of wider spread performance degradation, although the OP might have intended to convey concern about GUI performance more generally.

I agree that the topic of a performance test/example suite is interesting (and has been discussed before), but the OP's specific example is not about the computational engine/kernel.

For what it's worth, in Linux at least a value of the GUI's startup time is stored (upon full GUI closure) in the "Length of Startup in ms" field of the GUI preferences file. Perhaps it's stored on Windows too.

I suspect that the value represents the last individual timings, as opposed to any kind of average. So, likely varying slightly.

On my Linux box (quad core i5-7400 CPU @ 3.00GH), my ~/.maple/*/maplerc files together have this data:


Has anyone got widely different values for M2024 vs M2025, and if so then what's the platform?

1) I don't run any startup or initialization code for these examples.
2) My M2025 is an earlier beta, so ymmv.

An Explore of an IterativeMaps:-Escape call.

Escape_ex1.mw

(fun, except when it crashes...)

First 9 10 11 12 13 14 15 Last Page 11 of 594