acer

29914 Reputation

29 Badges

18 years, 207 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@dharr I am pretty sure that you already know why these 2D Math symbols can act as binary infix operators. But I thought that I'd explain it for the benefit of others.

The reason is that these 2D Math symbols are the rendering of special Maple names which have some key features and consequences:
1) They each are also some HTML (or unicode) entity name
2) As consequence of 1), each of their first characters is &
3) As consequence of 3), Maple allows them to be used as binary infix operators

restart;

 

We can use names beginning with & as infix operators, in general.

`&f` := (a,b) -> a/b:

 

R1 &f R2;

R1/R2

 

We can also do something similar in 2D Input.

`⊓`(R1, R2)

`⊓`(R1, R2)

 

That works as an infix call, because the operator's name is also
that of an HTML entity, and thus fortuitously happens to start
with the & character.

lprint(%)

`⊓`(R1,R2)

 

We can also assign to that special name.

`⊓` := proc (a, b) options operator, arrow; a*b/(a+b) end proc

 

`⊓`(R1, R2)

R2*R1/(R1+R2)

Download neutral_infix_entity.mw

@C_R I'm sorry but I don't understand.

Some of your examples involve generated names like _Zxx which represent integers (possibly with further assumptions, eg. range). Other of your examples involve _Z the special placeholder used by RootOf.

Those are two quite different kinds of thing. The former you could programmatically extract/reformat/replace in returned expressions, as you elect. The latter is key to how RootOf works, and cannot really sensibly be changed.

I am confused as to why they'd be discussed together.

note: I suppose the apparent collision is due in part to mathematical conventions. The "Z" in _Zxx is due to the convention of using the (close) symbol for representing the integers, and the "Z" in _Z relates to the convention of using "z" to represent some complex unknown.

You can programmatically extract and manipulate such names.

As a start...

restart;

S:=[solve({cos(x)*tan(x)/x,x>0},allsolutions)[]];

[{x = (1/2)*Pi+Pi*_Z1}, {x = Pi*_Z2}]

K:=[indets(S,And(suffixed(_),satisfies(hasassumptions)))[]];

[_Z1, _Z2]

aK:=map(getassumptions,K);

[{_Z1::(AndProp(integer, RealRange(0, infinity)))}, {_Z2::(AndProp(integer, RealRange(1, infinity)))}]

op(aK[1][1]);

_Z1, AndProp(integer, RealRange(0, infinity))

lprint(%);

_Z1, AndProp(integer,RealRange(0,infinity))

convert(aK,relation);

[{And(_Z1::integer, 0 <= _Z1, _Z1 <= infinity)}, {And(_Z2::integer, 1 <= _Z2, _Z2 <= infinity)}]

lprint(%);

[{And(_Z1::integer,0 <= _Z1,_Z1 <= infinity)}, {And(_Z2::integer,1 <= _Z2,_Z2
<= infinity)}]

Download prog_assump.mw

Hence you can programmatically manipulate and reformat as you choose.

I've changed your Post into a Question.

Please don't spawn a wholly separate new Question thread for this.

If you have followup details (or highly related queries) then please add them here instead.

On a related note, in Maple 2020 (but not earlier) I can get the following,

solve(x*ln(x)=ln(1/2*2^(1/2)));

       1/2, 1/4

I mention that because Maple 2023 (and Maple 2018.2) can get the following,

eq := x^x=1/sqrt(2);

x^x = (1/2)*2^(1/2)

solve( map(log[x], eq) );

1/2, 1/4

Download solve_lgx.mw  (That also attains if some condition like x>0 is included...)

Did you delete an earlier version of this Question (from about Dec 23rd?)

That earlier Question of yours had this worksheet, with problematic usage: streamline_Help.mw

And my Answer worksheet was: streamline_Help_ac.mw. I had to guess at figuring out what you might have meant, in the presence of muddle and very little expanation, about the intended roles of names eta and x.

You eventually attached to that Question thread the exact same worksheet as you've attached here. Unfortunately the explanation of what you intended related to x=0 was still unclear.

The intent is not made any clearer to me merely by your repeating it.

@emendes Your newly described, additional problem with width and formatting seems like a different matter.

The code in my Answer is just a programmatic approach to the originally described page-break issue. That's not going to do anything for width&line-breaking (if data in some row is too wide, at default).

It's possible to construct&embed such a data collection by forcing a smaller font size, so that all the entries in any row can fit in a standard page width if printing/exporting in portrait mode. (Is print-to-file in landscape an option?)

But maybe you could attach your actual worksheet, so that we might test ideas without guesswork or back-and-forth?

@Carl Love I'd interpreted that sentence by the OP as being a well-intentioned comment to provide extra detail. The OP might not be aware that the static export Tabulate of a DataFrame does nothing more than pass along arguments to DocumentTools:-Tabulate.
 

Side note: Does anyone think that DocumentTools:-Tabulate should be made into a top-level command? Does the user-friendliness outweigh robbing it from the global name-space? I see more people here use Tabulate than the command dataplot (added as top-level in 2015).

Please put your followups here, instead of spawning yet more separate new Question threads for this.

@Nicole Sharp Please don't spawn a wholly separate new Question/Post thread for this.

I will submitting a bug report: combine(...,units) pulls the units into Quantity, and convert(...,unit_free) and combine(...,unit) together cannot pull such out so as to cancel, etc.

But it is not helpful to split the topic and details.

(I have deleted that, using a delete-as-duplicate facility.)

@sand15 One can use the numframes option of Explore for that, yes.

Eg,  numframes=300  will make it run slower, at a finer granularity.

(Also, the checkboxes can toggle on/off the animation of either parameter. There are other Explore calling sequences, eg. to have any parameter not have such a toggle, or to flip on recording of the frames, etc.)

An example with recording (after the exploration gets played):
Explore_anim_ex2.mw

@Carl Love Is it the case that the assumptions might be passed to the call, here, rather than being baked into the procedure?

restart;

 

Simp:= (q::`=`)-> local e:= factor((lhs-rhs)(q));
    `if`(e::`*`, remove(f-> is(f<>0), e), e) = 0
:

 

eq:= diff(v(x),x,x)*exp(x^2) = 0;

(diff(diff(v(x), x), x))*exp(x^2) = 0

Simp(eq) assuming real;

diff(diff(v(x), x), x) = 0

eq2:= diff(v(x),x,x)*exp(abs(x)) = 0;

(diff(diff(v(x), x), x))*exp(abs(x)) = 0

Simp(eq2);

diff(diff(v(x), x), x) = 0

Download simpprodzero.mw

@dharr Your approach may be modified for 2D Input,

restart

M := Matrix(4, 3, {(1, 1) = 34, (1, 2) = 67, (1, 3) = 1, (2, 1) = 35, (2, 2) = 80, (2, 3) = 1, (3, 1) = 45, (3, 2) = 45, (3, 3) = 2, (4, 1) = 56, (4, 2) = 99, (4, 3) = 2})

Search column 3 for values 2 and return corresponding rows

M[[seq(`if`(M[i, 3] = 2, i, NULL), i = 1 .. upperbound(M)[1])]]

Matrix(%id = 36893627990679325620)

Search row 3 for values 45 and return corresponding columns

M[() .. (), [seq(`if`(M[3, i] = 45, i, NULL), i = 1 .. upperbound(M)[2])]]

Matrix(%id = 36893627990679308516)

Download search_2d.mw

The behavioral difference you show is not due specifically to Specialize, but rather to the fact that you're using distinct random variables (albeit with common distribution).

restart

with(Statistics):

 

X := RandomVariable(Normal(-3, 1)):
Y1 := RandomVariable(Normal(3, 1)):
Y2 := RandomVariable(Normal(3, 1)):
B1 := RandomVariable(Bernoulli(1/2)):
B2 := RandomVariable(Bernoulli(1/2)):

Mix2 := B1*X + (1-B2)*Y1;

_R2*_R+(1-_R3)*_R0

Variance(Mix2);
Histogram(Sample(Mix2, 10^4), size=[300,200])

11/2

 

Mix1 := B1*(X - Y1) + Y2;

_R2*(_R-_R0)+_R1

Variance(Mix1);
Histogram(Sample(Mix1, 10^4), size=[300,200])

11

 

Download Specialize_ac.mw

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