Carl Love

Carl Love

28065 Reputation

25 Badges

13 years, 22 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

It just assumes that all unweighted edges have weight 1. That is explained in the first paragraph of the help page ?GraphTheory,AllPairsDistance.

I'm not sure if that answers your Question, since I can't find a direct reference to "Betweeness centrality matrix".

I think that you've conflated the mostly typographical notion of the first or left-most coefficient with the algebraic concept of the leading coefficient. And it seems that you simply want the sign of the left-most. I think that this procedure will do it:

Sign:= (e::algebraic)-> 
   if e::{`+`,`*`} then thisproc(op(1,e))
   elif e::{`^`,function} then 1
   else try sign(e) catch "invalid argument": thisproc(op(1,e)) end try
   fi
:

Edit: Added type `^` to code above.

Your

= "inverse of tan (x)"

contains an invisible bad character. Just backspace over this part of the command and retype it manually; don't copy and paste.

In an arrow expression such as x-> D1, the name(s) to the left of the arrow (the x in this case) are called parameters. In the vast majority of cases, of course, the intent is that the expression will depend on the parameter(s); that is to say it'll be a function of its parameters. For this to happen, the parameter(s) must explicitly appear on the right side of the arrow. 

In your case, on the other hand, you're trying to make an arrow expression with an indirect reference to the parameter; x doesn't explicitly appear in D1. That's a case where you should use unapply.

From my brief review of your worksheet, it looks like all your numeric dsolves are simple integrations, so they can be replaced with numeric integration. You should try that; I think it would use less memory.

Unlike a typical calculator, Maple doesn't have an easy way to switch from "radian mode" to "degree mode". It's always in radian mode. But we can define functions so that the conversions between those modes can be done in a few keystrokes. I think that this is the level of convenience that you're looking for. We define two simple functions, the first to input 2D vectors in (magnitude, direction-in-degrees) form and the second to add them and then output the result in that form. You can put these in an initialization file:

`&<`:= (r,t)-> polar(r,t*Pi/180):
`&+`:= (a,b)-> evalf([op](polar(evalc(a+b)))/~[1,Pi/180]):

Usage:

(1 &< 30) &+ (1.5 &< 60);
      [2.418279598, 48.06753728]

If you're referring to the Grading package, I believe that that was introduced in 2014.

I don't know if this is what you're looking for, but you could figure the prime moduli over which the polynomial factors, like this:

for k to 20 do
   p:= ithprime(k);
   F:= Factor(n^2+n+39) mod p;
   if F::{`*`, `^`} then
      print('p'=p, F)
   fi
od:

 

1. node_data[1.., 1] extracts the first column from Matrix node_data. It could also be written node_data[.., 1].

2. If and are Matrices or Vectors with the same number of rows, then <A | B> is the Matrix formed by joining them horizontally.

3. If is a sequence, then < S > is the corresponding column vector.

4. add(ad_mat[i, j] * wt_mat[i, j], j = 1.. num_characters) multiplies the ith rows of the two Matrices elementwise and then adds those products. It could also be written add(ad_mat[i, ..] *~ wt_mat[i, ..])

5. seq(..., i = 1. . num_characters) does the above computation for every row.

6.  The line BetweenessCentrality_sorted := FlipDimension( x[2])))>, 1) has unbalanced brackets. It isn't syntactically correct, so it does nothing.

 

 

I suppose that you want to solve for {t, x, y, z}? The system is quadratic, not linear, in those variables, but we can proceed anyway. The system cannot be completely solved for those variables, but you can get a conditional solution with eliminate.

eliminate({eq||(1..4)}, {t,x,y,z});

This returns a list of two sets. The first set is equations solved for those 4 variables. When I ran it, I got 

{t = 1/2*(a-b)/z, x = -(j+m)*z/(a-b), y = -1/2*(a^2-b^2)/(j+m)/z, z = z}

which shows z as a free variable. (You may get another variable as the free variable.) The second set is expressions in the other variables ({a, b, j, m} in this case) that must be equal to for the first set to be valid. In this case, I got 

(a-b)*(a+b)*(a^2-b^2+j^2-m^2)

In other words, in order for there to be a solution for {t,x,y,z}, either a = b or a = -b or a^2 - b^2 = m^2 - j^2.

The solve command will not return these conditional (or singular) solutions. 

If you're talking about a boundary value problem (BVP) in ordinary differential equations (ODEs), then variable grid sizing is handled automatically by dsolve. It can be controlled with the options initmesh and maxmesh.

If you're talking about partial differential equations (PDEs), then these are called multigrid methods. These are far beyond what's currently implemented in Maple for the numeric solution of PDEs. You'd need to program your own. It'd be an extensive project, but ultimately doable.

Yes, using vectors is almost necessary. I can think of a convoluted way without vectors, but it's just an academic exercise and definitely not worth the trouble.

If you know that you're going to be exporting to Excel, you should probably be using Vectors from the very start, with datatype= hfloat. This would probably be more computationally efficient than lists. Note that you don't need to know the final number of elements in a Vector while you're building it, and that it's far, far more efficient to build a variable-length Vector than a variable-length list.

If you're using Maple 2019, there's some new syntax that simplifies building variable-length Vectors. Go to the help page ?assignment and read the section "Special Semantics of the ,= Assignment Operator". 

Use the setting

interface(prettyprint= 3):

This is usually set as the default. Somehow yours got changed. (Oddly, this is at least the second time recently that I've seen a user report this.) You can make it the default by using the menu commands Tools => Options => Display => Output Display => (2-D Math Notation or Typeset Notation) => Apply Globally.

 

The topic is called cluster analysis. You'll find much information on the Web about it. I wrote some Maple code a few years ago to do it. Someone who is better at searching MaplePrimes than I am should be able to find it.

I see nothing wrong in your worksheet. Radical algebraic expressions can appear in numerous equivalent forms, for example 1/sqrt(2) = sqrt(2)/2. Your collect command does nothing in this case: The result of your asympt is a series structure that's automatically collected into powers of k, so collect isn't needed.

First 133 134 135 136 137 138 139 Last Page 135 of 395