MaplePrimes Questions

 

I am transitioning from Mathcad to Maple, and I am currently working on some code to do a Gage R&R study using ANOVA. The attached math is from the 4th edition of the MSA manual. I got it to work in Mathcad, although I had to adjust things since Mathcad does not support 3D matrices.

My input matrix is a 2D matrix in which each cell contains a vector of measurements. In Maple, I seem to be able to make a 3D array with my data (if it is easier).

I have searched for a couple days for the right syntax. I am able to get the "right" number for SSA using my 2D Mathcad matrix--at least it is really close--but the other varibles are woefully off.

I would appreciate it if someone could at least point me in the right direction. Thanks.

Jno.

Hello Everyone;Hope you are fine. I am trying to convert the nonlinear system of ODE's into matric form using the following comand but not working it.

 

Kindly help me to do this. The cose is pasted and also attached. I am waiting for your kind response.

Thanks.

Question1_NEW.mw


 

restart; with(PDEtools, Solve); with(LinearAlgebra); with(plots); with(plottools); printlevel := 2

NULL

ZETA[0] := proc (t) options operator, arrow; 0 end proc:

sys222 := [(3/16)*Pi*C[2, 1](t)+(3/4)*Pi*C[1, 1](t)+diff(C[1, 1](t), t) = 0, 5*Pi*C[2, 2](t)+20*Pi*C[1, 2](t)+diff(C[1, 2](t), t) = 0, 800*ZETA[0](t)*C[1, 1](t)*Pi+(3/4)*Pi*C[2, 1](t)+(3/4)*Pi*C[1, 1](t)+diff(C[2, 1](t), t) = 0, 4320*ZETA[1](t)*C[1, 1](t)*Pi+4320*ZETA[0](t)*C[1, 2](t)*Pi+20*Pi*C[2, 2](t)+20*Pi*C[1, 2](t)+diff(C[2, 2](t), t) = 0, diff(ZETA[1](t), t)+(1/3)*C[2, 1](t) = 0, diff(ZETA[2](t), t)+(1/3)*C[2, 2](t) = 0]

[(3/16)*Pi*C[2, 1](t)+(3/4)*Pi*C[1, 1](t)+diff(C[1, 1](t), t) = 0, 5*Pi*C[2, 2](t)+20*Pi*C[1, 2](t)+diff(C[1, 2](t), t) = 0, (3/4)*Pi*C[2, 1](t)+(3/4)*Pi*C[1, 1](t)+diff(C[2, 1](t), t) = 0, 4320*ZETA[1](t)*C[1, 1](t)*Pi+20*Pi*C[2, 2](t)+20*Pi*C[1, 2](t)+diff(C[2, 2](t), t) = 0, diff(ZETA[1](t), t)+(1/3)*C[2, 1](t) = 0, diff(ZETA[2](t), t)+(1/3)*C[2, 2](t) = 0]

(1)

var1 := {C[1, 1](t), C[1, 2](t), C[2, 1](t), C[2, 2](t), ZETA[1](t), ZETA[2](t)};

{C[1, 1](t), C[1, 2](t), C[2, 1](t), C[2, 2](t), ZETA[1](t), ZETA[2](t)}

(2)

f, diffs := eval(GenerateMatrix(`~`[`-`](`~`[rhs](sys222), `~`[lhs](sys222)), var1))

f, diffs := Matrix(6, 6, {(1, 1) = -(3/4)*Pi, (1, 2) = 0, (1, 3) = -(3/16)*Pi, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = 0, (2, 2) = -20*Pi, (2, 3) = 0, (2, 4) = -5*Pi, (2, 5) = 0, (2, 6) = 0, (3, 1) = -(3/4)*Pi, (3, 2) = 0, (3, 3) = -(3/4)*Pi, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = -20*Pi, (4, 3) = 0, (4, 4) = -20*Pi, (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = -1/3, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = -1/3, (6, 5) = 0, (6, 6) = 0}), Vector(6, {(1) = diff(C[1, 1](t), t), (2) = diff(C[1, 2](t), t), (3) = diff(C[2, 1](t), t), (4) = 4320*ZETA[1](t)*C[1, 1](t)*Pi+diff(C[2, 2](t), t), (5) = diff(ZETA[1](t), t), (6) = diff(ZETA[2](t), t)})

(3)

NULL


 

Download Question1_NEW.mw

Hhow can i solve R it says here root of

Calculate.mws

1 - Is there a specefic place to make suggestions for the next revision of Maple Flow 2022?

(As opposed to just blasting them out on the forum)

2 - When entering text in a container...

I hit Ctl+R to switch to Math mode ... but how do I switch back to text mode in the same container?

For instance I hit the space bar for a text container and enter some text...

Then I hit Ctl+R to enter some math like maybe to enter a variable with a subscript...

Then I want to return to text mode in the same container...

How do I do this?

Thanks for any help.

 

Good day.

I am working on a network flow problem that uses a linear programming (simplex) technique.The flow is directed across 3 regions (a, b, and c) and there are 2 nodes within region a, 4 nodes in region b, and 5 nodes in region c.

I wish to determine the minimum cost from regions a to c and from regions b to c that satisfies the requirement of each of the 5 nodes in region c. The objective and constraints are constructed and Maple produces the minimum solution (see attached). While the output is useful when the number of nodes is small, I would like to extend this to a larger-scale case and so the output would need to be more user-friendly / graphic.

I have 2 questions - 

1. Does anyone know a way to attach labels for each region and each node to these solution matrices?
    For instance -  the first matrix, x, specifies a quantity of 2,000 that flows from node #1 in region a to node #2 in region b
2. Is it possible to produce a network graph showing the directed flow from each region and from node to node?

Thanks to all for reading this!

MaplePrimes_Network.mw

I'm displaying several lines of equations that are all pretty similar and sometimes maple changes the order making it look unpleasent. e.g., the equations are essentially of the form a - b and sometimes maple will output -b + a

If I do sort(E) then it prints them all as -b+a and I cannot get this reverse no matter what options I try

I can do op(E) and it breaks up the expression in to terms but add(op(E)) just ends up doing the same out of order expression.

%+`(seq(Reverse([op(E))])));

essentially gives me what I want, surely there is an easier and more robust way?

How do you apply colors to an entire solid of revolution? I can't seem to color the bases of a disk. Please help.

Here is what I have. I would like the entire solid to be the same color,transparency,etc.

v := VolumeOfRevolution(4, x = 1 .. 2, volumeoptions = [color = blue, transparency = 0.6], orientation = [270, 0, 15], view = [0 .. 3, -5 .. 5, -5 .. 5], labels = [x, y, z], output = plot, axis = horizontal, scaling = constrained)

I'd like to print a high res and quality worksheet but maple has very poor printing.

 I'd like to change the font so I can print more text. I'd like to change the dpi of the print to get higher quality.

Right now I'm having to print screen then scale in photoshop just to get a halfway decent print. I don't want pages of wrapped text that is very confusing to view. If I zoom out all the way on the worksheet I can almost get what I want as far as the size and wrapping(I want to avoid wrapping and there seems to be no way to turn this "feature" off). Of course when I zoom out and use print screen the quality is extremely low due to resolution issues. [So "zooming out" let's me stuff most of the data in to view that I want but then when I use print screen to capture it the quality is so low as not to be useable due to the dpi issue. Of course if I use any of maples printing "features" it will ignore the zoom scaling so as to be useless]

The only thing I can see on how to solve this issue is to save to latex and modify the latex. The problem is that maple puts a lot of junk formatting in the latex to make the wrapping look the same which is exactly what I do not want.

Maple has a "copy as image" but this doesn't seem to do anything. The printing of Maple really needs to be worked on. It's so limited to be almost useless.

Why solutions (5) and (6) are different? The solution (5) is obtained by putting f=0 of the series, while (6) is the result by taking limit at f->0. 

check.mw

I want to know if it is possible to use the declare command from the PDETools package for a function

f(x,y,z)

and still, having the notation $\frac{\partial f}{\partial x}$ instead of $f_x$ for the Maple command %diff(f(x,y,z),x)

Thanks !

Kevin

recurssion.mw

NULL

"f(x,t) :=(|Psi|)^(2)"

proc (x, t) options operator, arrow, function_assign; abs(Psi)^2 end proc

(1)

" a(t):=piecewise(0<= t<=1,1.5*t,1<= t<=2,1.5*(2-t))"

proc (t) options operator, arrow, function_assign; piecewise(0 <= t and t <= 1, 1.5*t, 1 <= t and t <= 2, 1.5*(2-t)) end proc

(2)

" y[a](t):=piecewise(0<= t<=0.1,a(t),0.1<= t<=0.2,-a(t))"

proc (t) options operator, arrow, function_assign; piecewise(0 <= t and t <= .1, a(t), .1 <= t and t <= .2, -a(t)) end proc

(3)

"y(t):=y[a](t)+mu(t)"

proc (t) options operator, arrow, function_assign; y[a](t)+mu(t) end proc

(4)

"w(t):=&int;x(t)*f(x,t) &DifferentialD;x"

proc (t) options operator, arrow, function_assign; int(x(t)*f(x, t), x) end proc

(5)

" v(t):=y(t)-w(t)*w(t)"

proc (t) options operator, arrow, function_assign; y(t)-w(t)^2 end proc

(6)

NULL

diff(K(x, t), t) = beta*v(t)*f(x, t)

Error, (in y[a]) too many levels of recursion

 

"map(int, , t)"

Error, invalid function arguments

"map(int,,t)"

 

NULL

Here psi is a general wave function from schrodinger wave equation.

Download recurssion.mw

The problem comes from the link https://www.mapleprimes.com/questions/234398-Convert-Maple-Code-To-Python-#comment287424.

We know that when we compile a C or C ++ function, it generates an executable file.  Then we are free from source code.  For example. the function below returns a square matrix A where    "A[i, j]" is the distance from vertex i to vertex j in the graph G. My computer system is Windows.

// C Program for Floyd Warshall Algorithm
#include <stdio.h>

// Number of vertices in the graph
#define V 4

/* Define Infinite as a large enough
  value. This value will be used
  for vertices not connected to each other */
#define INF 99999

// A function to print the solution matrix
void printSolution(int dist[][V]);

// Solves the all-pairs shortest path
// problem using Floyd Warshall algorithm
void floydWarshall (int graph[][V]) {
    /* dist[][] will be the output matrix
      that will finally have the shortest
      distances between every pair of vertices */
    int dist[V][V], i, j, k;

    /* Initialize the solution matrix
      same as input graph matrix. Or
       we can say the initial values of
       shortest distances are based
       on shortest paths considering no
       intermediate vertex. */
    for (i = 0; i < V; i++)
        for (j = 0; j < V; j++)
            dist[i][j] = graph[i][j];

    /* Add all vertices one by one to
      the set of intermediate vertices.
      ---> Before start of an iteration, we
      have shortest distances between all
      pairs of vertices such that the shortest
      distances consider only the
      vertices in set {0, 1, 2, .. k-1} as
      intermediate vertices.
      ----> After the end of an iteration,
      vertex no. k is added to the set of
      intermediate vertices and the set
      becomes {0, 1, 2, .. k} */
    for (k = 0; k < V; k++) {
        // Pick all vertices as source one by one
        for (i = 0; i < V; i++) {
            // Pick all vertices as destination for the
            // above picked source
            for (j = 0; j < V; j++) {
                // If vertex k is on the shortest path from
                // i to j, then update the value of dist[i][j]
                if (dist[i][k] + dist[k][j] < dist[i][j])
                    dist[i][j] = dist[i][k] + dist[k][j];
            }
        }
    }

    // Print the shortest distance matrix
    printSolution(dist);
}

/* A utility function to print solution */
void printSolution(int dist[][V]) {
    printf ("The following matrix shows the shortest distances"
            " between every pair of vertices \n");
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
            if (dist[i][j] == INF)
                printf("%7s", "INF");
            else
                printf ("%7d", dist[i][j]);
        }
        printf("\n");
    }
}

// driver program to test above function
int main() {
    /* Let us create the following weighted graph
            10
       (0)------->(3)
        |         /|\
      5 |          |
        |          | 1
       \|/         |
       (1)------->(2)
            3           */
    int graph[V][V] = { {0,   5,  INF, 10},
        {INF, 0,   3, INF},
        {INF, INF, 0,   1},
        {INF, INF, INF, 0}
    };

    // Print the solution
    floydWarshall(graph);
    return 0;
}

 

The above functions will be packaged as the disall.exe , and then we will move them anywhere in my computer and run it in Powershell.  We don't have to deal with the source code unless we want to change it.

I mean can Maple do something like that?

with(GraphTheory);
G := Graph([1, 2, 3, 4, 5], {{1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 5}, {3, 4}, {4, 5}});
AllPairsDistance(G);

For exmaple, can I package the above code snippet into an exe file?

Given: f := (R1 + Rc)/(4*C*Rf*R1)

Where ...

R1 := 10^5

R2 := 300*10^3

R3 := 75*10^3

Rf := 10^4

Rc := R2

C := 10^(-6)

Now to find the value of "f" enter...

f=

and I get ...

25.000 + 2.500*10^(-4)*Rc

But ...if I enter ...

(R1 + Rc)/(4*C*Rf*R1) = 

I get 100.000

Which I think is the correct answer.

Why isn't Maple Flow 2022 returning 100 when I ask for the value of "f" ?

I'm sure I'm doing something incorrect so maybe some kind soul will give me some guidance.

Thanks for any help.

PS - Is there an easy way to enter a set of equations from Maple Flow  2022... like the above... without having to copy and paste each one individually?

hallo evert body please how i do calculate this integral

in maple 18

ttp.pdf

int_{0}^{2\pi}(\cos^{i}(\theta)-\cos^{i+2}(\theta))d\theta

Dear All,
I want to extract the coefficients of Chebyshev of an arbitrary function, for example, exp(x). I know that we can use the following command to make a Chebyshev series expansion of exp(x):
chebyshev(exp(x),x);
the above returns the sum of nth Chebyshev polynomials multiplied by Chebyshev coefficients as the following:
1.26606587775201*T(0, x) + 1.13031820798497*T(1, x) + 0.271495339534077*T(2, x) + 0.0443368498486638*T(3, x) + 0.00547424044209371*T(4, x) + 0.000542926311913993*T(5, x) + 0.0000449773229542760*T(6, x) + 3.19843646244580*10^(-6)*T(7, x) + 1.99212480641582*10^(-7)*T(8, x) + 1.10367717095000*10^(-8)*T(9, x) + 5.50589697979079*10^(-10)*T(10, x)

I like to take the coefficients 1.266,1.1303, 0.2714, 0.04433, and so on. How can I do it?
Thanks

First 180 181 182 183 184 185 186 Last Page 182 of 2308