acer

33183 Reputation

29 Badges

20 years, 202 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You can get that error message if you are assigning the result to a name, and the statement ends with a semicolon.

Perhaps the easiest remedy for that is to terminate the assignment statement with a full colon, and then evaluate the name in another line.

Eg,

  P := plots:-implicitplot(...):
  P;

If that's not the issue, then upload and attach your worksheet using the green up-arrow in the toolbar of the Mapleprimes editor.

@Honigmelone I don't understand what you mean by, "However I found that I inject e^(...) at some point." Are you saying that action is not something under your control and which you cannot avoid doing, and that you simply want to undo it before calling invlaplace?

restart;

kernelopts(version);

`Maple 2024.2, X86 64 LINUX, Oct 29 2024, Build ID 1872373`

expr := e^(-s*a_pos)/(b*s^2 + c);

e^(-s*a_pos)/(b*s^2+c)

lprint(expr);

e^(-s*a_pos)/(b*s^2+c)

new := subsindets(expr, identical(e)^anything, u->exp(op(2,u)));

exp(-s*a_pos)/(b*s^2+c)

lprint(new);

exp(-s*a_pos)/(b*s^2+c)

inttrans[invlaplace](new, s, t) assuming a_pos>0;

Heaviside(t-a_pos)*sin((c/b)^(1/2)*(t-a_pos))*(c/b)^(1/2)/c

Download Honigmelone_1_ac.mw

Is this the kind of thing you're after?

I'm taking your mention of "convert" as a hint that you might be trying to change the units by which to interpret DO2i, with a corresponding rescaling. You could accomplish that directly using plots:-pointplot. Or you could accomplish that by constructing a new list with the desired (converted) units, and then using ScatterPlot.

Below, I did a couple of variants, as I'm not sure whether you want to see the names DO2i and Hb in the axes labels, or not.

Also, if you utilize Units(g/dL), etc, in the useunits or labels options, then Maple will render them in upright Roman font, as opposed to the double-braces that this site shows them with. Of course you are also free to utilize just the plain names instead. I've done a mix, so you can see your choices.

restart; with(Units); with(Statistics)

Automatically loading the Units[Simple] subpackage
 

cte := 1.34*Unit('mL'/'gram')

SaO2 := .99

Hb := [seq(i*Unit('g'/'dL'), i = 4 .. 12)]NULL

[4*Units:-Unit(g/dL), 5*Units:-Unit(g/dL), 6*Units:-Unit(g/dL), 7*Units:-Unit(g/dL), 8*Units:-Unit(g/dL), 9*Units:-Unit(g/dL), 10*Units:-Unit(g/dL), 11*Units:-Unit(g/dL), 12*Units:-Unit(g/dL)]

SvO2 := .75

Q := 3.4*Unit('L'/'min')

BSA := 1.8*Unit('m'^2)

DO2i := elementwise(cte*Hb*SaO2*Q/BSA)

[0.1670533333e-5*Units:-Unit(m/s), 0.2088166667e-5*Units:-Unit(m/s), 0.2505800000e-5*Units:-Unit(m/s), 0.2923433334e-5*Units:-Unit(m/s), 0.3341066667e-5*Units:-Unit(m/s), 0.3758700000e-5*Units:-Unit(m/s), 0.4176333334e-5*Units:-Unit(m/s), 0.4593966667e-5*Units:-Unit(m/s), 0.5011600000e-5*Units:-Unit(m/s)]

plots:-pointplot(`<|>`(`<,>`(Hb), `<,>`(DO2i)), useunits = [g/dL, mL/(:-min*m^2)], gridlines, size = [700, 450])

plots:-pointplot(`<|>`(`<,>`(Hb), `<,>`(DO2i)), useunits = [g/dL, mL/(:-min*m^2)], gridlines, size = [700, 450], labels = [InertForm:-Display('Hb')*Unit(g/dL), InertForm:-Display('DO2i')*Unit(mL/(min*m^2))])

new := `~`[convert](DO2i, units, mL/(:-min*m^2))

[100.2320000*Units:-Unit(mL/(min*m^2)), 125.2900000*Units:-Unit(mL/(min*m^2)), 150.3480000*Units:-Unit(mL/(min*m^2)), 175.4060000*Units:-Unit(mL/(min*m^2)), 200.4640000*Units:-Unit(mL/(min*m^2)), 225.5220000*Units:-Unit(mL/(min*m^2)), 250.5800000*Units:-Unit(mL/(min*m^2)), 275.6380000*Units:-Unit(mL/(min*m^2)), 300.6960000*Units:-Unit(mL/(min*m^2))]

ScatterPlot(Hb, new, gridlines, size = [700, 450], labels = [InertForm:-Display('Hb')*Unit(g/dL), InertForm:-Display('DO2i')*Unit(mL/(min*m^2))])

``

NULL

Download PlotQuestionMaplePrimes_ac2.mw

 

ps. The InertForm:-Display calls use used so that the names DO2i and Hb (if you use them in the labels) wouldn't evaluate to the lists assigned to them, if you were to assign the actual plots to names and then later pass them around and get them re-evaluated.

There is a bullet-point in the Description section of the ExpressionTools:-Compare Help-page, that explains that it uses the uneval procedure parameter modifier. That bullet point states:

   Compare uses the uneval parameter modifier. Providing the evaluate option
   tells Maple to fully evaluate expression1 and expression2 before computing
   and displaying their differences.

And here is that option working with the OP's example:

restart

ode := diff(diff(y(x), x), x)+sin(y(x)) = 0; IC := y(infinity) = Pi; sol := [dsolve([ode, IC])]

sols := dsolve([ode, y(x__IC) = y__IC])

y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2)

(1)

ExpressionTools:-Compare(sol[1], (y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2))[1], evaluate)

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. Pi))+_a+c__2)), _a = 0 .. _Z))+x+c__2)

 

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. y__IC))+x__IC+c__2)), _a = 0 .. _Z))+x+c__2); "_noterminate"

(2)

Download Compare_and_indexing_output_ac0.mw
 

note: You don't need to use a distinct pair of statements, in order to do it in some other way. Here are two other ways that each handle your example with just a single statement.

restart

ode := diff(diff(y(x), x), x)+sin(y(x)) = 0; IC := y(infinity) = Pi; sol := [dsolve([ode, IC])]

sols := dsolve([ode, y(x__IC) = y__IC])

y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2)

(1)

eval(('ExpressionTools:-Compare')(sol[1], (y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2))[1]))

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. Pi))+_a+c__2)), _a = 0 .. _Z))+x+c__2)

 

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. y__IC))+x__IC+c__2)), _a = 0 .. _Z))+x+c__2)

(2)

(proc (e1, e2) options operator, arrow; ExpressionTools:-Compare(e1, e2) end proc)(sol[1], (y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2))[1])

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. Pi))+_a+c__2)), _a = 0 .. _Z))+x+c__2)

 

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. y__IC))+x__IC+c__2)), _a = 0 .. _Z))+x+c__2); "_noterminate"

(3)


Download Compare_and_indexing_output_ac.mw

It happens that simplify does not always find constructions like completing-the-square.

Of course, the following is example-specfic (ad hoc) and not general, since it depends on the choice of variables supplied to collect and CompleteSquare. But, fwiw, using Maple 2026.0,

restart;

interface(showassumed = 0):

#assume(a>=0, b>=0, c>=0);

#assume(x::real, y::real,z::real);

S := sqrt(x^2+(a+sqrt(y^2+(b+sqrt(z^2+c^2))^2))^2);

(x^2+(a+(y^2+(b+(c^2+z^2)^(1/2))^2)^(1/2))^2)^(1/2)

E := expand(S);

(x^2+a^2+2*a*(y^2+b^2+2*b*(c^2+z^2)^(1/2)+c^2+z^2)^(1/2)+y^2+b^2+2*b*(c^2+z^2)^(1/2)+c^2+z^2)^(1/2)

collect(E,[x,y],u->Student:-Precalculus:-CompleteSquare(u,[a,b]));

(x^2+(a+(y^2+(b+(c^2+z^2)^(1/2))^2)^(1/2))^2)^(1/2)

Download rad_ex1.mw

One difficulty, AFAICS, is that every character in your .txt file is separated by a zero-byte null instance. I got rid of those using a Linux command in a terminal shell.

Your criteria for where your regions began/ended are rather vague and hazy, so I just used small values like 0.1,0.3.

I make a list from the 2nd column, and then search that for the positions where your described changes happen.

Links to file attachments are at the end.

restart;

# After removing all zero-byte null instances.
# I did that in Linux with:     tr -d '\0' < F12_1.txt > foo.txt

M := ImportMatrix("foo.txt"):

 

# retain only rows with only numeric and nonnegative entries.
newM:=M[[seq(`if`(andmap(type,M[i],And(numeric,nonnegative)),i,NULL),i=1..op([1,1],M))]]:

 

# number of rows and columns
op(1,newM);

6045, 5

plot(newM[..,[1,2]],size=[700,300]);

L2 := convert(newM[..,2],list):

p1 := ListTools:-SelectFirst(1,(u->u>0.1),L2,output=indices)[1];

158

p2 := p1 + ListTools:-SelectFirst(1,(u->u<0.1),L2[p1+1..],output=indices)[1];

4716

plot(newM[p1..p2,[1,2]],
     view=[0..newM[p2,1]*1.1, default], size=[700,300]);

p3 := p2 + ListTools:-SelectFirst(1,(u->u>0.3),L2[p2+1..],output=indices)[1];

4886

p4 := p3 + ListTools:-FindMaximalElement(L2[p3+1..], position)[2];

5958

# slope
(newM[p4,2] %- newM[p3,2]) %/ (newM[p4,1] %- newM[p3,1]);
value(%);

`%/`(`%-`(83.760, .32737), `%-`(73.53, 65.58))

10.49467044

plot(newM[..,[1,2]],size=[700,300],
     axis[1]=[tickmarks=[[newM[p1,1],newM[p2,1],newM[p3,1],newM[p4,1]],rotation=Pi/4]]);


Download FDS_ERT_01ac.mw

foo.txt

Projection mapping of an image onto a sphere can be done.

For example (since Maple 18), see here. That old Post started out as code to do it through various Array and plotting structure programming techniques. But these days it can be done directly with the command plot3d and its image option.

You don't have to scale down the imported image, but its manual rotation, etc, in the GUI can get sluggish, if the image is large. If you don't want to scale it then you could simply pass that URL string as the value for plot3d's image option.

raw:=ImageTools:-Read("https://www.evl.uic.edu/pape/data/Earth/512/PathfinderMap.jpg"):
img:=ImageTools:-Scale(raw,1..201):

plot3d(1,th=0..2*Pi,p=-Pi..0,image=img,coords=spherical);

Are you trying to get the AI to cough up ExpressionTools:-Compare ?

I suspect that a start to improving your prompt is to not use the word "new", as in "new command", since that's a bit like an open invitation for it to invent a new name for an as-yet nonexistent command. But even without the presence of the word "new", it may hallucinate.

For example, even without using the word "new" and "highlight" I got it to invent the nonexistent,
    ExpressionTools:-HighlightDifferences

[edit] I got it to suggest ExpressionTools:-Compare with the prompt, "What is an existing, actual Maple command that shows in 2D-Output the differences between two expressions". That was my third prompt.

The indexing/selection notation is reliable and documented, and not new.

It's also very commonly used.

By the way, you typo'd in the alternative syntax that you wrote that you'd usually go for.

u := [a,b,c,d];

[a, b, c, d]

u[2..-1];

[b, c, d]

u[2..];  # the -1 is implied

[b, c, d]

[op(2..-1),u];  # syntax the OP mentioned

[2, -1, [a, b, c, d]]

[op(2..-1, u)];  # likely intended

[b, c, d]

Download ind_ex.mw

ps. Apart from its terseness (on top of its commonness and efficiency) this indexing/selection notation has another advantage over using op. With square-bracket indexing the notation also works for Vectors and Matrices. Sometimes this adds the convenience that the same code can handle either Vector/Matrix as well as list, or do so with only minor adjustment.

I'm a bit pressed to think of situations in which using op like that would be preferable, except for the rare (for me) situation where I was trying to prep for a subsop call, and was double-checking/forming my op call's details.

A Vector is a mutable data-structure, and its entries can be changed in-place.

That's not true of lists. (in-place replacement into a list "fakes" the in-place aspect, and actually creates a new list in memory.)

You could assign Vectors to names A and B  and they might happen to have the same entries at some moment. But they are still two different containers, whose entries might later change.

You could instead compare the two Vector instances with, say, EqualEntries.

This is not a bad question; variants have been asked many times before. Here's a good one.

And here's some fun, with is,

restart;

V1 := [a, b];

[a, b]

V2 := [a, b];

[a, b]

V3 := [sqrt(a^2), b];

[(a^2)^(1/2), b]

EqualEntries(V1, V2);

true

andmap(is, V1-V2, 0);

true

andmap(is, V1-V3, 0);

false

andmap(is, V1-V3, 0) assuming a::positive;

true

Download Vec_andmap.mw

@EdmondR Does this edit of your first .flow file do any better, or does it open all blank?

Statik_ac01.zip

(There seems to be a corrupted `MapleFlow-Image` substructure in your first file, which I've removed; if we're lucky then that is enough to make the rest of the document accessible.)

And here's an edited version of your second .flow file (again, with a corrupted `MapleFlow-Image` substructure removed):

Statik_ac02.zip

Is there a reason for you to not use the Calendar package?

For example (and you can tweak this in various documented ways  including which hour on the reference date, how many finer-level fields you pick out, etc.),

restart;


(I don't know whether you might want another reference date, eg. November 24, 4714 BCE)

F := jd->parse(Calendar:-VariantFormat(
                 Calendar:-AdjustDateField(Date(-4712,1,1,12),
                                           "date",jd),
"%Y,%m,%d" )):

 

Calendar:-JulianDayNumber( 2026, 4, 5 );

2461136

F(%);

2026, 4, 5

 

Calendar:-JulianDayNumber( 1911, 12, 25 );

2419396

F(%);

1911, 12, 25

Download Calendar_ex.mw 

 

Without using parse and a format, you could also pick off values using static exports of the constructed Date object, eg, using a procedure such as,

     jd -> [':-Year',':-Month',':-DayOfMonth'](
                  Calendar:-AdjustDateField(Date(-4712,1,1,12),"date",jd))[]:

Perhaps the simplest way would be something like,

    seq(11 .. 234, 11)

I describe it as simple because it uses only your original values of 11 and 234, and doesn't require that you also know how to come up with the extra value of 21 which is iquo(234,11) .

But read on for others, some close to your attempt, some also simple, etc.

You could read the help-page for the iquo and irem commands, and utilize those. (There are many ways to proceed, and for your very small example the efficiency differences will be small.)

(This site isn't showing the full results from this do-loop; but they show in Maple itself.)

Here are five ways, starting with an edited variant of what you were trying with a loop.

1st: Something like the OP's original
for a from 3 to 234 do if irem(a, 11) = 0 then print(a, "yay", (1/11)*a) end if end do

231, "yay", 21

2nd: Similar to the above.
seq(ifelse(irem(a, 11) = 0, a, NULL), a = 3 .. 234)

11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231

iquo(234, 11)

21

3rd
seq(11*i, i = 1 .. iquo(234, 11))

11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231

4th
seq(i, i = 11 .. 234, 11)

11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231

NULL

5th
for a from 11 by 11 to 234 do print(a, "yay", (1/11)*a) end do

231, "yay", 21

NULL

Download if_question_i.mw


The third way does,
   seq(i*11, i=1 .. 21)
but it also shows you how that value of 21 can be obtained, using iquo(234,11) .

The fourth way just calls seq, using 11 for the increment.

You could compare the efficiency of doing a single iquo call, versus using irem (or your other divisibility test) for multiple values. The 5th way illustrates (analogously to the 4th way) that if you get your loop increment right then you don't need a divisibility test for each value of the loop index.

Here is one way,

restart;

kernelopts(version);

`Maple 2026.0, X86 64 LINUX, Mar 05 2026, Build ID 2001916`

eq:=x^2+2*x+1=0;

x^2+2*x+1 = 0

PDEtools:-Solve(eq, x, 'dropmultiplicity'=false);

x = -1, x = -1


Download PDEtools_solve_march_28_2026_ac.mw

Most all type's can also be used like a property. (See second bullet point on the ?property Help page)

But many properties do not match any type, and those cannot be used as a type.

NonZero is a property, but not a type.

Non(0) is a type specification, and can be used like a property check.


ps. The Help page for ?property states that Not can be used as a synonym for Non, which means that they can be used in a similar manner (ie. for their primary purpose of property-checks, and, as it happens, for type-checks). It doesn't state that they are existentially identical.

pps. You mentioned that you can "combine" properties. With a similar kind of effect, for types,
   And(integer,Non(0))
   Or(posint,negint)

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