mmcdara

7891 Reputation

22 Badges

9 years, 54 days

MaplePrimes Activity


These are replies submitted by mmcdara

@Carl Love 

I think I'm also among those whi have been fooled by these stumbling blocks.
Could you help me understand what makes your results that different than those I uploaded in my initial comment.

And what yours are different from these:
Download horner_stat.mw

@Preben Alsholm 

 I would replace Pi and sqrt(2) by evalf(Pi) and sqrt(2.), respectfully...
Right, I had already noticed that (equation (4) in the file  I attached to my my comment).
I suspected the error was a "display" erro due to the lentgh of the factored expression.

Yhanks for the kernelopts tip.

Interesting question, even if 10 or 12 is two small a degree to hope seeing something.
Nevertheless, using a degree of 500 (in Maple 2015 convert(P(x), horner, x) generates an error if degree(P(x), x)=1000) shows several differences as described in this file horner.mw

In summary, it doesn't seem (that is my own feeling and I will be happy to read the opinion of more skilled members here) that the Horner representation has any real practical interest beyond its educational aspect.

@vv 

because it is the closest of a build-in function (I already found your second solution).
As you're using linalg, I guess there's no LinearAlgebra equivalence, is there?

@Carl Love 

Thanks, this is what I suspected.

@acer 

I didn't know about the `&#`||k||`;` syntax.

Does this mean that  mo(...)mi(...) are only useful if you want to change the font or add modifiers like mathsize and mathcolor for instance (not to mention msup, mover, ... of course)?

@mohandt 

Sorry, I delete my reply

@Axel Vogt 

Thanks Axel.
I had just seen that Combine gave more or less the desired result when I saw your reply.

Unfortunately It doesn't work as it is with Maple 2015 (simplify doesn't drop the numeric part of the integrands out of the integrals... but this can be fixed by doing some extra opertaions).

Thanks again

Updated file: Int_int.mw

@C_R 

Agree, Advanced Search is pitiful

@C_R already answered your question, so just take this as a simple comment:

eq  := a*x^2 + b*x = v;

eq1 := lhs(eq) - rhs(eq);

eq2 := a*x^2 + b*x - v;

a*x^2+b*x = v

 

a*x^2+b*x-v

 

a*x^2+b*x-v

(1)

type~([eq, eq1, eq2], `=`)

[true, false, false]

(2)

map(e -> if type~(e, `=`) then 'lhs'(e) = lhs(e) else "not of type `=`" end if, [eq, eq1, eq2])

[lhs(a*x^2+b*x = v) = a*x^2+b*x, "not of type `=`", "not of type `=`"]

(3)

for e in [eq, eq1, eq2] do
  try
    print('lhs'(e) = lhs(e))
  catch:
  end try
end do:

lhs(a*x^2+b*x = v) = a*x^2+b*x

(4)

select(type, [eq, eq1, eq2], `=`)

[a*x^2+b*x = v]

(5)

selectremove(type, [eq, eq1, eq2], `=`)

[a*x^2+b*x = v], [a*x^2+b*x-v, a*x^2+b*x-v]

(6)

 

Download examples.mw

@sursumCorda 

Another idea which avoid intrducing intermediate points in the definition of the red line rl:

bl   := plot([[1, 0], [6, 5]], color="#0072BD", thickness=3):
lr3D := transform((x, y) -> [x, y, -1/2])(lr):
rr3D := transform((x, y) -> [x, y, 1/2])(rr):

rl := plots:-spacecurve([x, x, tanh(100*(x-7/2))], x=1..6, color=red, thickness=3):

bl3D := transform((x, y) -> [x, y, 0])(bl):

plots:-display(
  lr3D, rr3D, bl3D, 
  rl,
  lightmodel=none, labels=[x, y, z], orientation=[-90, 0, 0]
)


For information: my first try was

plot([[1, 1], [6, 1]], color=red, thickness=3):
plots:-display(
 lr3D, rr3D, bl3D,
 transform((x, y) ->[ x, y, tanh(100*(x-7/2)])(rl)
 ...
)

but for some unknown reason (in Maple 2015) the red line is not "broken and looks like the result of 

plot([[1, 1, -1], [6, 1, 1]], color=red, thickness=3):



For fun this can be generalized this way to make a weawing

For_fun.mw

 

I asked this question a few years ago (I wasn't aware to recover it) and, from memory, I was said the order was predefined my Maple (lines are always before rectangles circles, ...).

Here is a workaround where each line is transformed into a polygon, for instance:

h  := 0.1:
al := [[1, 0], [6, 5]]:
al := [al[], (al[[2, 1]] +~ [[0, h]$2])[]]:
pl := PLOT(POLYGONS(al, COLOR(RGB, ColorTools:-HexToRGB24("#0072BD")[]), STYLE(PATCHNOGRID))):

A_workaround.mw

@Preben Alsholm 

Thanks for these last comments.

(123 is indeed quite large)

To illustrate my previous reply here is a very simple example concerning what I am working on.
The aim here is to prove the relation: variance(V) = mean(V^2) - (mean(V))^2.

Teaching_probability.mw

@Carl Love 

Thank you Carl for your comments.

I'm often confused by the differences in behaviour between  fun~(...), map(fun, ...) and map(z -> fun(z), ...) which, in my mind, seem to be three different ways of doing the same thing, which they sometimes are,  but which are not always.

@Preben Alsholm 

I agree that the name of the integration variable doesn't matter and I wouldn't have been surprised if the simplification had replace both r1 and r2 by something like _t123.
So I agree that is not a "mathematical bug".

So let me put it another way by explaining the context in which these formulas appear.
A quite consensual notation (see PDF) for the probability density function of a random variable X is fX(x): please note the correspondence between the index of f and its argument.
For another random variable  Y this pdf will be written fY(y).

Next, one writes Int( x * fX(x), x=-oo..+oo) the expectation of X (same kind of notation for Y's).
So this kind of formula for the product of the expectations of X and Y.
        Int( x * fX(x), x=-oo..+oo) *  Int( y * fY(y), y=-oo..+oo),
Of course this is equal to
        Int( x * fX(x), x=-oo..+oo) *  Int( x * fY(x), x=-oo..+oo)
or even 
        Int( t * fX(t), t=-oo..+oo) *  Int( t * fY(t), t=-oo..+oo)
but the first notation "makes more sense" or is "more intuitive" than the second.

The formulas I used in my question came from the preliminary definition of two random variables named R[1] and R[1] whose respective pdf where noted varphi[1] and varphi[2] (random variables are indexed names to avoid introducing several different names ... thus the same indexing for the pdfs and for the integrations variables).
And for readaibility I  consider that preserving this correspondence between the names of the random variables and the integration variables is important.

Perhaps you'll understand better if I tell you that this is part of an interactive course on probability where the classic formulae are derived using Maple instead of being written on slides?
I feel that the teaching of probability is difficult enough not to introduce additional complexity due to potentially confusing notations, even if they are correct.

I guess I would have title my question "Could this be seen as simplify taking an unwelcome liberty?"

Thank you for your answer and for the time you spent reading mine.

First 32 33 34 35 36 37 38 Last Page 34 of 154