mmcdara

7891 Reputation

22 Badges

9 years, 61 days

MaplePrimes Activity


These are replies submitted by mmcdara

The "inverse of the curvature matrix", as you named it, is indeed a method to approximate the covariance matrix.
I emphasize on the use of the term approximation: the matrix you obtain is not the exact covariance matrix, contrary to what happens in linear regression.

If you are not familiar with "linear regression", you have to know that it is based on very strict probabilistic assumptions and that, under these assumptions, one can obtain analytical formulas (in fact matrix expressions) for the regression coefficients, their confidence intervals, their covariance matrix, ... and so on.

These formulas do not exist for non linear regression, unless there exists some transformation which transforms the non linear regression into a linear one.
So, as a rule, there is no expression of the covariance matrix.

Be careful with some shortcuts if you use Mac OSX, F keys are usually attached to a specific function (F3 for instance).
You can assign a F key another function, but I do not know if one can modify the Maple shortcuts?

@MaPal93 

Here is an extremely simple example, tell me if it models the situation that corresponds to your question number 1.
If it doesn't, could you please tell exactly what you want and what bothers you?

 

restart:

with(LinearAlgebra):
with(Statistics):

assume(sigma > 0, tau > 0)

A   := RandomVariable(Normal(0, sigma)):
aux := RandomVariable(Normal(0, tau)):
B   := 2*A+aux:

V := < A, B>:
Covariance_V  := Mean~(V . V^+);

S := DiagonalMatrix((1/sqrt)~(Diagonal(%))):
Correlation_V := S . Covariance_V . S

Covariance_V := tau

 

Correlation_V := tau

(1)

# Now add to V a vector E of iid centered normal rvs.
# Let VE = V + E

E := < RandomVariable(Normal(0, epsilon)), RandomVariable(Normal(0, epsilon)) >:

VE := V + E

VE := Vector(2, {(1) = _R+_R3, (2) = 2*_R+_R0+_R4})

(2)

# Even if E is not correlated to V the correlation coefficient between VE[1] and
# VE[2] is not equal to the one between V[1] and V[2]:

Covariance_VE  := Mean~(VE . VE^+);

SE := DiagonalMatrix((1/sqrt)~(Diagonal(%))):
Correlation_VE := SE . Covariance_VE . SE

Covariance_VE := Matrix(2, 2, {(1, 1) = `&epsilon;`^2+`&sigma;`^2, (1, 2) = 2*`&sigma;`^2, (2, 1) = 2*`&sigma;`^2, (2, 2) = `&tau;`^2+`&epsilon;`^2+4*`&sigma;`^2})

 

Correlation_VE := Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2*`&sigma;`^2/(sqrt(`&epsilon;`^2+`&sigma;`^2)*sqrt(`&tau;`^2+`&epsilon;`^2+4*`&sigma;`^2)), (2, 1) = 2*`&sigma;`^2/(sqrt(`&epsilon;`^2+`&sigma;`^2)*sqrt(`&tau;`^2+`&epsilon;`^2+4*`&sigma;`^2)), (2, 2) = 1})

(3)

 


 

Download Do_you_agree.mw

@sursumCorda 

Thank you for the info.
When I'm at work I use Maple 2021, Maple 2015 is my personal license, so it's not that bad :-)

@dharr @Linhuchong

For beginners the term "table" can mean "some kind of Excel worksheet", a matrix, or a table in Maple's sense.
Maybe this is just this?

restart:
w := (m, n) -> 83.21291776*(-1.)^((m+n)/2-1.)/(m*n* 1.189516952*10^6*m^4+3.172357982*10^5*m^2*n^2+4.972742706*10^5*n^4):
M := Matrix(25$2, (i, j) -> w(2*i-1, 2*j-1))

 

@sursumCorda 

Excellent, this is a situation I often met and that always solved in a lesss elegant way.
I vote up.

@C_R 

Nice!

@C_R 

I'd thought using plottools:-extrude, but it doesn't give the expected result.
The explanation is this one: the, let's say plottools:-disk you want to extrude is contained (by default) in the [x, y] plane and the extrusion trajectory is a curve in the [x, y, z] space along which the disk is translated (the image is those of a stack plates) : if you cut the extrusion curve by a plane // to [x, y] yoy obtain the same initial disk.
To generate a "filled torus" we would need also a rotation of the disk around the current point of the extrusion curve.

@Carl Love 

We only plot the surfaces ...

And it makes sense and I agree that, implicitely the interiors are filled.

This question came from the original question where @C_R said "The union is simple". 
Plotting the two torus with opaque surfaces gives the impression that we have plot she surface of a bretzel. But making the traparent reveals that ve have in fact two torus.

I guess the question is "what is the union of two torus?"
And probably Topology and CAD give different definitions.

And constructing the https://en.wikipedia.org/wiki/Connected_sum of two torus is as difficult as constructing their intersection

@C_R  @Kitonum

Ok,

But if you are dealing with solids the union is not that trivial.
What you plot with 

display([torus([1,1,1], 1, 2),torus([1,6,1], 1, 2)]...) 

are surfaces  and they penetrate each other, which is all but the the "union" of two "solid" tori.

By the way, do any of you know have an idea to plot a "solid" torus (I tried plotting a plottools:-disk and make it totate, but the result is not that good, even with small rotation increments):

with(plottools):
with(plots):

display(disk([3,1], 1, color=red, style=polygon)):
T    := transform((x, y) -> [x, 0*sqrt(x^2+y^2), y]):
d[0] := T(disk([3,1], 1, color=red, style=polygon)):

h := Pi/500:
a := copy(h):
c := 1:
while evalf(a-(3/2*Pi+h)) <= 0 do
  d[c] := rotate(d[0], a, [[0,0,0], [0,0,1]]);
  a    := a+h;
  c    := c+1;
end do:
display([seq(d[i], i=0..c-1)], scaling=constrained, lightmodel=light1);

@C_R 

Strange it doesn't appear correctly for you 
(I used Maple 2015.2)

@Carl Love 

Thanks for correcting me.

Far be it from me not to admit that I was wrong in my reply, but I catch this blunder to make a general remark about plot.

I read again the plot/options help page

gridlines=truefalse
When gridlines=true or gridlines is provided, default gridlines are drawn. The default is gridlines=false.

Effectively writting only gridlines switches the grid on.  So I suggest, for quick readres like men, that the first line be changed in gridlines=truefalse, void (or something like that).

About the second range...
There are effectively many ways to define the plot range (I was only aware of the first one):

  • plot(f(x), x = -0.667 .. 1.71, view=[default, 5 .. 20)  
    This was the only one I was aware of, and it remains my prefered one as all is All is explicitely stated.
     
  • plot(f(x), x = -0.667 .. 1.71, 5 .. 20)  
    Awfull (IMO)
    Maple V,  Language Reference manual, p 156, presents this same syntax, further the "Other options" paragraph doesn't mention view.
    Clearly the possibility to use this syntax today is a remnant of ancient Maple versions: If someone at some time introduced the view option I like to think it was for good reasons, for instance to get more explicit and understandable writing. 
    Has this syntax been kept only for compatibility reasons?
     
  • plot(f(x), x = -0.667 .. 1.71, y=5 .. 20)  
    An latter evolution of the previous syntax to make the command les ambiguous for the reader?
     

My filling is that plot has evolved by layering and keeping old things without cleaning up and giving it a good sweep.
This situation also appears in the syntactic differences between plot and PLOT (color= versus COLOR(...) to mention only one), or in the fact that some plot options are not avaliable for other 2D plot (which implies changing by hand the underlying PLOT structure).

More globaly the 

@Kitonum 

This is another point of view, I hadn't seen it that way.

From https://en.wikipedia.org/wiki/Torus
"In geometry, a torus (plural tori, colloquially donut or doughnut) is a surface of revolution generated by revolving a circle in three-dimensional space about an axis that is coplanar with the circle."
Thus the torus is variety of dimension 2, not a "solid".

But maybe the OP has seen the things differently, just as you did.

Wait and see.

load your worksheet by clicking in the green up arrow in this menubar.

Without knowing what you did BEFORE this plot command, the error message is incomprehensible and one may suspect anything and everything.
A few hints:

  • A plot requires only ONE range (plot generates a 2D plot): if you have TWO ranges, use plot3d instead.
  • The option gridlines, whose correct syntax is gridlines=true (or false, the default value) is unavaliable for plot3d (or any 3D plot).
First 50 51 52 53 54 55 56 Last Page 52 of 154