mmcdara

1042 Reputation

13 Badges

4 years, 1 days

MaplePrimes Activity


These are questions asked by mmcdara

Hi, 

I have an expression like this one 
x := -h(U) + f( f( g( f(U+W*X)*V) + g( f(W)*g(V) ) ) );
I and I would like to extract the names f, g, h of the functions it contains.
I'v been stucked on this problem for a while and I finally found this could be done doing this 
op~(0, indets(x, function({name, `+`, `*`})))

I don't understand why this works not even if it is the good way to proceed (the few examples I've built seem to prove this command works).
What way would you use to tackle this problem?

TIA

Hi, 

Is it possible to define a linear idempotent operator in Maple?
I found no clue in the define help page.
To fix the ideas, an example could be the transposition operator on the ring of matrices

Thanks in advance

Hi, 

I've define a list V of 2 random variables and saved the result in an .m file.
When I read this same file and try to sample V I get a message error which, after quick search, comes from the fact that the V I read is no longer a random variable.
How can I fix this?

TIA


 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

with(Statistics):

V := [ RandomVariable(Normal(0, 1)), RandomVariable(Uniform(0, 1)) ]

[_R, _R0]

(2)

map(v -> [attributes(v)][3], V);
print~(map(Sample, V, 5)):

"[[Typesetting:-mi("_ProbabilityDistribution",italic = "true",mathvariant = "italic"), Typesetting:-mi("_ProbabilityDistribution0",italic = "true",mathvariant = "italic")]]"

 

Vector[row](5, {(1) = -1.07242412799827, (2) = -.329077870547065, (3) = -.617091936909790, (4) = .214466745245291, (5) = -0.254281280423846e-1})

 

Vector[row](%id = 18446744078251172318)

(3)

dir := currentdir():
f   := cat(dir, "/Desktop/rvs.m"):
save V, f

 

restart

with(Statistics):

dir := currentdir():
f   := cat(dir, "/Desktop/rvs.m"):
read f:

anames(user);
V;

dir, f, V

 

[_R, _R0]

(4)

print~(map(Sample, V, 5)):

Error, (in Statistics:-Sample) invalid input: expected distribution or algebraic expression with random variables, but received _R

 

attributes(V[1]); # The Vs are no longer random variables


 

Download Why.mw

Hi, 

I represent 3 thin parallel slices of colors red, green and blue; all have the same transparency equal to 0.5
For the default orientation of the display, the blue slice is on the forefront, the red one in the background and the green one in beween. Then the blue slice is "bluer" than green and  the green one "greener" than red (FIG 1)
If you rotate manually the figure in order to place the red slice in the forefront and the blue one in the background, you expect to have the red slice "redder" than the green one and the green one "greener" than the blue one (FIG 2)
This is not the case.

The order in which the slices appear in the PLOT3D command defines the foreground and the background, but these latter are not dynamically recalculated when the figure is rotated.
To recover the correct colors one must revert the order of the slices in PLOT3D (FIG 3)

Are we comdamned to change to change manually the order of the slices in PLOT3D or does it exist an option whixh avoids doing so?

Don't pay too much attention to the plots above for the foreground is strangely correct on figure 2 ???

restart

with(plottools):

alpha := Pi/18.:
a := 2*cos(alpha):
b := 2*sin(alpha):
e := 0.02:
p := [[0,0,0],[a,b,0],[a,b,1],[0,0,1]],
     [[0,e,0],[a,b+e,0],[a,b+e,1],[0,e,1]],
     [[0,0,0],[0,e,0],[0,e,1],[0,0,1]],
     [[a,b,0],[a,b+e,0],[a,b+e,1],[a,b,1]],
     [[0,0,0],[a,b,0],[a,b+e,0],[0,e,0]],
     [[0,0,1],[a,b,1],[a,b+e,1],[0,e,1]]

[[0, 0, 0], [1.969615506, .3472963554, 0], [1.969615506, .3472963554, 1], [0, 0, 1]], [[0, 0.2e-1, 0], [1.969615506, .3672963554, 0], [1.969615506, .3672963554, 1], [0, 0.2e-1, 1]], [[0, 0, 0], [0, 0.2e-1, 0], [0, 0.2e-1, 1], [0, 0, 1]], [[1.969615506, .3472963554, 0], [1.969615506, .3672963554, 0], [1.969615506, .3672963554, 1], [1.969615506, .3472963554, 1]], [[0, 0, 0], [1.969615506, .3472963554, 0], [1.969615506, .3672963554, 0], [0, 0.2e-1, 0]], [[0, 0, 1], [1.969615506, .3472963554, 1], [1.969615506, .3672963554, 1], [0, 0.2e-1, 1]]

(1)

f   := k -> transform((x, y, z) -> [x, y+k, z]):
col := k-> COLOR(RGB, op(ListTools:-Rotate([1, 0, 0], -k))):
t   := TRANSPARENCY(0.5):
PLOT3D(POLYGONS(p, t, col(0)), f(1)(POLYGONS(p, t, col(1))), f(2)(POLYGONS(p, t, col(2))), AXESLABELS(2, 3, 1))

 

PLOT3D(POLYGONS(p, t, col(0)), f(1)(POLYGONS(p, t, col(1))), f(2)(POLYGONS(p, t, col(2))), AXESLABELS(2, 3, 1))

 

PLOT3D(f(2)(POLYGONS(p, t, col(2))), f(1)(POLYGONS(p, t, col(1))), POLYGONS(p, t, col(0)), AXESLABELS(2, 3, 1))

 

 


 

Download Background_Foreground.mw

Hi, 

 

Does it exist a way to get all the types a variable verifies?
For instance
x:=4;
type(x, t); # true for t in {positive, posint, algebraic, ...}

Thanks in advance

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