acer

32288 Reputation

29 Badges

19 years, 290 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@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...)

@mmcdara I suggest you submit an SCR for it, thanks.

I see the problem on Linux as well.

If I remove all output from the worksheet and restart then the GUI renders the problematic plot once, and then rerendering that plot's output again shows the error notice. And that process can be repeated, without closing the worksheet.

@Scot Gould The preferences all appear to be in order. It seems like a new GUI bug, specifically for opening via the launcher.

I suggest that you submit a bug report.

@Tom GIV That's great that it's working for you.

You might now wonder how you could automate the augmenting of libname, so that it's not needed to be explicitly entered in each session (or after restart).

Here are a few different ways, of which you could choose one:

1) First find what is the resulting string from this Maple command,
         cat(kernelopts('homedir'),"/maple/toolbox");
     Then concatenate/append that with, say,
         "/myKinProject/lib"
      and create such a folder in your OS.
      (note: Maple understands forwardslash on all platforms. It makes it easier than
       having to deal with escaping "\" by having double backslashes. But of course
       you'll know how to make such a folder in your OS, using its filemanager, etc.)
      If you put your .mla in that folder then after full closure and relaunch
      of Maple that location should appear in libname.
1b) You also add a Maple version number as another layer to that location, eg.
           toolbox/2024/myKinProject/lib
       That makes it get added in just that version.
2) Put your previous manual call like,
         libname := "C:\\Users\\tom\\Documents\\MyEquil.mla",libname;
    in a personal initialization file. See the Help topic,
         worksheet,reference,initialization
3) (not recommended by me) Put your .mla file in a folder already in libname,
     eg. the result from this,
         cat(kernelopts('mapledir'),"/lib");
     I don't like that because I dislike tinkering with my Maple installation if I
     don't have to. Also, you have to remember you did this when you upgrade.

And, lastly, you might not want the contents of your .mla archive to be
available (assigned names, etc) in every Maple session. You can get finer
control by making your procedure the export of a package module. Eg. in your
build session,

MyEquil := module()
    option package;
    export KinAddCurveData;
    KinAddCurveData := what_you_had_working;
end module:

and then LibraryTools:-Save on MyEquil instead of on KinAddCurveData. Then
you can utilize it in your other sessions by doing either,

   with(MyEquil);
   KinAddCurveData();

or just,

    MyEquil:-KinAddCurveData();

Using a package controls your global namespace, eg. If you have many such
procedures assigned to names then the global names don't have those values/bindings
automatically. But the usage is like for other stock packages.

So, you can get flexible control, if you'd like.

First 6 7 8 9 10 11 12 Last Page 8 of 591