acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Christopher2222 IMO there are several weaknesses in your methodology. (I order these by decreasing severity, from mistake to quibble.)

1) You're measuring the sum of CPU time across multiple cores, which is a serious flaw. If you want to measure the wall-clock time duration for which the user has to wait, here, either use time[real]() or an appropriate call to CodeTools:-Usage. Your approach gives a confused idea about how a machine with more cores might finish the job more quickly, and about how long the computation actually takes.

2) As you have it, you're also measuring the time it takes for the interface to print the output. While that may be relatively negligible here, a clear picture in general would be to have separate operations to measure computations and (possible) something else dedicated to measure interface (eg, GUI, CLI) output timing. Also, there are some computations whose result take much longer to print than to compute. You could end the computation with a full colon.

3) This example tests the performance of the externally linked Intel MKL's dgesvd routine. That might interest some people [see also discussion in a 2008 Post of mine in which I too suggested a Maple benchmark, and also here], but it's not a great indicator of Maple's speed on general numerics (whether in evalhf or arbitrary precision modes).

4) Why set UseHardwareFloats:=true ? Shouldn't you have a specific and clear reason for changing away from default settings -- for this or any benchmark example?

@FDS The first form works ok for me, on columns of DS.

Test_date_ac2.mw

Perhaps you tried it with the wrong kind of single-quotes?

If you know for sure which columns will have the numeric entries then it's more efficient to only examine those. See attachment.

@FDS Do you mean this kind of result?

add(`if`(u::numeric, 1, 0), u = DS);

        418

nops(select(type, convert(DS, list), numeric));

        418

@Carl Love I think you intended eval(phi1, S2[2]) instead of eval(S2[2], phi1) 

I did some extra fiddling there, because I suspect that neither dataplot or plot (for Matrices/Vectors) understand units yet.

But this seems to work, in your Maple 2022.2.

  plots:-pointplot(res, lact, useunits = [Unit(h), 1], style = line)

If you upload and attach your .cvs file then we can reproduce, fix, and demonstrate the whole thing.

You could upload/attach a .zip file, if the Mapleprimes uploader baulks at the .cvs filename extension.

Are you entering it as capitalized Pi, or pi?

Maple interprets Pi as the well-known constant, but pi is just a name with no special meaning to Maple.

If you have some other problem, please explain it more clearly, or upload and attach your worksheet with the green up-arrow in the Mapleprimes editor.

@minhthien2016 Your last example can be handled by,

mylist := [(x - 7)*(x^2 + (-2*m - 30)*x + m), (x - 8)*(x^2 + (-m + 8)*x + 2*m)]

[(x-7)*(x^2+(-2*m-30)*x+m), (x-8)*(x^2+(-m+8)*x+2*m)]

subsindets(mylist,
           And(polynom(anything,x),`+`),
           u->sort(map(normal,u),x));

[(x-7)*(x^2-2*(m+15)*x+m), (x-8)*(x^2-(m-8)*x+2*m)]

Download sgn_ex6.mw

It could save time if you provided your more complicated examples now, rather than staggering them.

@gabbbooooo Please put your followups here, instead of spawning wholly separate new Question threads for them.

@lemelinm There are two different light-gray shades of grid line possible, with one being even lighter than the other. So, when you write, "What I need is to have the light-gray gridline on the x-axis to be only on the values of 3, 6 and 9." I don't know which shade you want.

You could compare these (including zooming, if you want),

plot(0, x = 0 .. 10, y = 0 .. 4, gridlines = true,
     axis[1] = [ tickmarks=spacing(3,0),
                 gridlines=[spacing(30,0),subticks=9] ],
     labels = [x*InertForm:-Display(10)^8*``(Unit(m)), `t `(Unit(s))]);

plot(0, x = 0 .. 10, y = 0 .. 4, gridlines = true,
     axis[1] = [ tickmarks=spacing(3,0) ],
     labels = [x*InertForm:-Display(10)^8*``(Unit(m)), `t `(Unit(s))]);

It's also not clear to me what grid lines you want on the vertical axis.

@FDS Previously you did not mention how you wanted to use the results, so I showed only the simplest way to access the parsed results (as Records whose fields can be access individually).

For comparing them, you could turn each into a Date object.

If you only want to use the Dates for other tasks, then you could sort the new Vector of Dates directly. If you'd also like to sort the earlier parsed results then you could construct the permutation key, which may then be used to reorder either Vector.

restartNULL

dates := Vector(3, {(1) = "9/7/2023", (2) = "12/8/2020", (3) = "10/10/2021"})

times := Vector(3, {(1) = "14:08", (2) = "09:12", (3) = "22:45"})

str := `~`[cat](dates, times)

Vector[column](%id = 36893628358824725308)

G := `~`[StringTools:-ParseTime]("%m/%d/%Y%H:%M", str)

Dts := map(proc (g) options operator, arrow; Date(g:-year, g:-month, g:-monthDay, g:-hour, g:-minute) end proc, G)

Vector[column](%id = 36893628358824709644)


The Date objects can be compared using `<`, so they can be sorted directly.

evalb(Dts[2] < Dts[1])

true


If we no longer need G, we could simply sort Dts
and use these dates from here on.

sort(Dts)

Vector[column](%id = 36893628358824698932)


The following permutation can be used to sort G or Dts.

K := sort(Dts, 'output' = ':-permutation')

[2, 3, 1]

Dts[K]

Vector[column](%id = 36893628358824696756)

G[K]

Vector[column](%id = 36893628358824690380)

NULL

Download StringToDateTime_ac2.mw


ps. The is also a Time command, though I did not need it above. There are Help pages for the Date and Time commands, as well as the Calendar package which has some additional commands for handling Date objects.

@lemelinm Thank you for your kind words.

Sorry, I don't understand your objection to the code from my previous reponse. Aren't the "principal" (major) tickmarks on the x-axis at 0,3,6, and 9?

You might have to upload your worksheet that uses it, and then write more clearly what aspect is wrong.

Isn't the result the same as the image shown in your original Question? Or, was that original actually somehow wrong too?

note. You appear to also want gridlines, and possibly also to zoom in/out? It's not always possible to control how the gridlines appear in the GUI, under zoom, etc. But maybe this is not on-topic. I don't yet understand your objections, and whether it's with the axis-ticks or the gridlines.

ps. If t represents time then wouldn't you also want the s to be Unit(s), so as to be rendered in upright Roman for consistency?

@lemelinm It's not clear what you want done with the x and 10^8, if the Unit(m) is inside brackets.

You can force any specific tickmarks you'd like. Eg,

plot(0, x = 0 .. 10, y = 0 .. 4, gridlines = true,
     axis[1] = [tickmarks=[0,3,6,9], gridlines=[subticks=1]],
     labels = [x*InertForm:-Display(10)^8*``(Unit(m)), `t `(s)])

Or you could specify a spacing between them (with anchoring at, say, zero), so that you get additional multiples shown if you zoom out.

plot(0, x = 0 .. 10, y = 0 .. 4, gridlines = true,
     axis[1] = [tickmarks=spacing(3,0), gridlines=[subticks=1]],
     labels = [x*InertForm:-Display(10)^8*``(Unit(m)), `t `(s)])

See the Help page ?plot,tickmarks

@FDS You now seem to be using the 24-hour convention, so the hour format is %H rather than %l. (See the Help-page for the ParseTime command.) I could not tell which you wanted from your original example.

You can apply the ParseTime command across the Vector using either elementwise syntax or the map command.

StringToDateTime_ac.mw

@Rana47 You yourself provided a formula for u[1], and indeed you assigned that formula to that very name. So that assigned u[1]=0 gives your first cited BC.

By evaluating that assigned name u[1] (which was assigned the formula) at sigma=-sigma and equating to 0, we can produce the formula for your other BC.

When you see something like A=A inside one of the solutions it means that A can take any arbitrary value. For example, in the following solution all the parameters except k and B can take any arbitrary value (except possibly sigma=0). Using this for k and B is all that's needed to satisfy the given BCs.

simplify(eval([u[1], eval(u[1], sigma = -sigma)],
         [B = -1/4*p^3*y^4 - 1/2*y^2*q - A*y, k=-1]));

      [0, 0]

I didn't use your own syntax, u[1](-sigma) = 0, u[1](sigma) = 0 since you assigned an expression rather than an operator to u[1]. Here's the same kind of thing, but with u[1] an operator instead of an expression.  help_c_solve_o.mw

ps. Why do you seem to think that your two BCs might allow all the other parameters to specify both some fixed A and B (with neither arbitrary)?

Note that you could also get something like this formula for A, with B arbitrary.

u[1] := -(-2*p^3*sigma^3*y^4+4*k*p^2*sigma^2*y^3+4*p^2*sigma^2*y^3-3*k^2*p*sigma*y^2-4*q*sigma^3*y^2-6*k*p*sigma*y^2+k^3*y-3*p*sigma*y^2+3*k^2*y+3*k*y+y)/(8*sigma^3)+A*y+B

simplify(solve({u[1] = 0, eval(u[1], sigma = -sigma) = 0}, [A, k], explicit, real, parametric))

[[y <> 0, sigma <> 0, A = (1/4)*(-p^3*y^4-2*q*y^2-4*B)/y, k = -1]]

Download help_c_solve_p.mw

First 62 63 64 65 66 67 68 Last Page 64 of 591