Rouben Rostamian

MaplePrimes Activity


These are answers submitted by Rouben Rostamian

You have a set of equation SysEq which are linear in the variables dq.  The coefficient matrix is obtained through
J := LinearAlgebra:-GenerateMatrix(SysEq, dq)[1];

In your case J is an 8x11 matrix.  To display it, do:
evalm(J);

 

@assma Here is the code to do that calculation.  I assume that your 6.28 is actually meant to be 2π.  Change it to anything else as needed.

The 2D version

err2 := abs(wr(x,y) - w3(x,y));

range2 := x=0..2*Pi, y=0..2*Pi;

First, be sure that this one works correctly:

maximize(err2, range2);

Only then measure the usage statistics:

CodeTools:-Usage(maximize(err2, range2));

 

The 3D version

err3 := abs(wr(x,y,z) - w3(x,y,z));

range3 := x=0..2*Pi, y=0..2*Pi, z=0..2*Pi;

maximize(err3, range3);

CodeTools:-Usage(maximize(err3, range3));

 

Download mw.mw

 

restart;

with(Statistics):

pts := [[0, 0], [1, 13], [2, 21], [6, 45], [12, 54], [15, 77]];

[[0, 0], [1, 13], [2, 21], [6, 45], [12, 54], [15, 77]]

The equation of the straight line that goes through the point (2,21) is  y = 21+a*(x-2),

that is, y = a*x-2*a+21. The LinearFit function does not accept a model involving an additive
constant
such as the 21 above, but that's alright.  We subtract 21 from the data, fit with the model

y = a*x-2*a, and then add 21 to the result.

pts1 := (x->x[1])~(pts);

[0, 1, 2, 6, 12, 15]

pts2 := (x->x[2]-21)~(pts);  # note the subtracted 21

[-21, -8, 0, 24, 33, 56]

L := LinearFit(a*x-2*a, pts1, pts2, x) + 21;  # note the added 21

HFloat(4.151724137931035)*x+HFloat(12.69655172413793)

Let's verify that L passes through (2,21):

eval(L, x=2);

HFloat(21.0)

plot([pts, L], x=0..15);

Download linearfit.mw

An object of the form [u1, u2, ..., un] is called a list in Maple. If that list is named X, then X[i] is the ith entry of that list. Each of the ui can itself be a list. If every ui is a list, then we say X is a list of lists. In that case the notation X[i][j] indicates the jth element of the ith list in X.

The argument J of your proc is expected to be a list of list.

  • The first line of the proc creates a list L from the list J as follows. Let's say the ith entry of L is [a,b,c]. Then the ith entry of L is the two-element list
        [a, (b+c*I)/a + 50*(1+I)/abs(J[1][2])]
    where I is Maple's notation for sqrt(-1), and abs() is the absolute value.
    Note: You would want J[1][2] to be nonzero, otherwise you will be dividing by zero.  In the example in the last line of your post is J[1][2] zero.  That's bad.
  • The second line of the proc defines a vector R whose ith entry equals the ith entry in L.
  • The next line says that:
        T := abs(L[1][3]);
        r := L[1][4];
    But L[1][4]  makes no sense since it attempts to pick the 4th entry of the list L[1] which is a list of two entries; there is no 4th entry.  Check for typos.

The rest of the code should be self-evident.

 

In addition to the ways pointed out by Robert Lopez, here are four other methods to calculate the dot product without complex conjugation:

  1.  LinearAlgebra:-DotProduct(<a,b>, <c,d>, conjugate=false);
  2. LinearAlgebra:-DotProduct(<a,b>, <c,d>) assuming real;
  3. <a,b>^%T . <c,d>;
  4. <a,b>^+ . <c,d>;

My preferred method is #4 since it requires the least amount of typing.

 

@Earl If all you want is the final graphics that you have shown in your worksheet, then it can be done through a direct evaluation of parameter ranges.  This produces better-looking graphics, without the need for "cheating" with a hi-res grid.

Here are the details: mw2.mw
Edit: removed a couple of lines of unused code from an earlier version

restart;

with(LinearAlgebra):

Example 1: We have two equations in three unknowns:

eqns :=
   1*x + 2*y + 3*z = 4,
   5*x + 6*y + 7*z = 8;

x+2*y+3*z = 4, 5*x+6*y+7*z = 8

The augmented matrix of our system of equations:

M := GenerateMatrix({eqns}, {x,y,z}, augmented);

_rtable[18446884503773816462]

Here is the solution, expressed as the parametric equations of a line in 3D:

<x, y, z> =~ LinearSolve(M, free=t);

_rtable[18446884503773811046]

Example 2:  The equations are expressed as Ax=B, where A is an `&x`(m, n) matrix and

and B is an m-vector:

m, n := 3, 5;

3, 5

A := RandomMatrix(m,n);

_rtable[18446884503773806830]

B := RandomVector(m);

_rtable[18446884503773809230]

The augmented matrix:

M := < A | B >;

_rtable[18446884503773810190]

Here is the solution -- an afine manifold in R^n:

<(x[i] $i=1..n)> =~ LinearSolve(M, free=t);

_rtable[18446884503773805494]

Are you sure that's Maple?  To me it looks like a mupad notebook.

How do I know that?

Rename Bugged.mw to Bugged.mw.zip , unzip it, then examine the contents.

 

 

 

  • You don't need Maple to see that { θ(r,z) ≡ 0 and σ(r,z)  ≡ 0 } is the solution of your equations. Perhaps you meant something else?
  • Although you label your equations as PDEs, they are not PDEs.  They are ODEs because they involve derivatives with respect to r only.
  • As to Maple's error message, you need to change
    pdsolve(PDE1, PDE2, IBC, numeric);
    to
    pdsolve({PDE1, PDE2}, IBC, numeric);
    but that's not really needed if all you have are ODEs.

 

Your ibc consist of three boundary conditions but no initial condition.  You don't mean that, do you?  In the following I will ignore the first of the three conditions. It turns out at the end that the first conditions is implied by the other two.

restart;

pde := diff(u(x,t),t) = diff(u(x,t),x,x);

diff(u(x, t), t) = diff(diff(u(x, t), x), x)

Let's try solving with the help of PDEtools:

sols := PDEtools:-SimilaritySolutions(pde) assuming t>0, x::real;

u(x, t) = _C1, u(x, t) = _C1*x+_C2, u(x, t) = _C1/(t^(1/2)*exp((1/4)*x^2/t)), u(x, t) = _C1+erf((1/2)*abs(x)/t^(1/2))*_C2, u(x, t) = (_C1*x+_C2*t)/(t^(3/2)*(1/x)^(1/2)*exp((1/4)*x^2/t)*x^(1/2))

We are presented with five options:

nops([sols]);

5

The fourth option looks promising:

sols[4];

u(x, t) = _C1+erf((1/2)*abs(x)/t^(1/2))*_C2

Unfortunately that is not correct.  The absolute value sign should not be there.

I have reported this to Maple Support as a bug.  The correct solution is:

sol := u(x,t) = A + B*erf(x/(2*sqrt(t)));

u(x, t) = A+B*erf((1/2)*x/t^(1/2))

We determine A and B by applying the boundary conditions at infinity:

conds := {
    c[1] = limit(rhs(sol), x=-infinity),
    c[2] = limit(rhs(sol), x=+infinity) } assuming t>0;

{c[1] = A-B, c[2] = A+B}

Solve for A and B

ans := solve(conds, {A, B});

{A = (1/2)*c[1]+(1/2)*c[2], B = (1/2)*c[2]-(1/2)*c[1]}

Plug A and B into the solution:

eval(sol, ans);

u(x, t) = (1/2)*c[1]+(1/2)*c[2]+((1/2)*c[2]-(1/2)*c[1])*erf((1/2)*x/t^(1/2))

 

 

The argument of the complexplot is malformed.  Here is the corrected version.

restart;
with(plots):
z := polar(1.05, (1/10)*Pi);
p1 := polarplot(1, color = grey, axis[radial] = [color = "Blue"]):
p2 := complexplot([seq(evalc(z)^n, n = 1..21)],
    style=point, symbol=solidcircle, symbolsize=15, color=red):
display([p1,p2], scaling=constrained);

 

Here is a rush answer to a rush question I don't expect it to make much sense to you if this is your first contact with Maple.

restart;
G := (y,v) -> [v, g/H*(mu__B + mu__C - sqrt(1 + v^2))];    # v stands for dy/dx
de := diff~([y(x), v(x)], x)[] = G(y(x),v(x))[];
ic := y(0)=0, v(0)=0;
params := g=1, H=1, mu__B=1, mu__C=1;
sys := eval([de,ic], [params]);
dsol := dsolve(sys, numeric, method=rkf45);
plots:-odeplot(dsol, [[x,y(x)],[x,v(x)]], x=0..5);

 

Here are my thoughts regarding your questions.

  • If you live in the US, you may consider taking a remedial math course in your local community college.  These don't cost very much, and I think will be more effective than trying to learn the material on your own.  Having a teacher and classmates whom you can talk to can be very helpful.
  • I don't know of a product that you can buy to test your mathematical ability, but most universities administer a Math Placement Test to entering students to determine their level of mathematical preparation, and then recommend a suitable course within the mathematical hierarchy to begin one's education.
  • You should give some thought as to your reasons for wanting to take a college algebra course.  If it is for the sake of learning some new material, that's fine.  But if you do that as a stepping stone toward a further goal, you should really talk to someone who knows about such matters and seek expert advice before you invest your time, money, and effort toward that goal.

 

@das1404 Kitonum has already answered your question for pyramids with triangular and square bases. The worksheet pyramid.mw shows how to construct and plot pyramids having n-gons for their bases and the altitudes of whose lateral faces are given.  See if it is of use to you.

 

restart;

ode := diff(y(x), x, x)-exp(y(x))+2 = 0;

diff(diff(y(x), x), x)-exp(y(x))+2 = 0

 

dsolve({ode, y(0) = a, (D(y))(0) = b}, y(x), series);

y(x) = series(a+b*x+(-1+(1/2)*exp(a))*x^2+((1/6)*exp(a)*b)*x^3+(-(1/12)*exp(a)+(1/24)*(exp(a))^2+(1/24)*exp(a)*b^2)*x^4+((1/120)*exp(a)*b*(b^2+4*exp(a)-6))*x^5+O(x^6),x,6)

 

Download mw.mw

First 38 39 40 41 42 43 44 Last Page 40 of 58