Ronan

1341 Reputation

15 Badges

13 years, 139 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are answers submitted by Ronan

If you are using Windows 10 turn File History. That keeps a running backup of all files you work on. You coud set to save  once a hour. It has gotten me out of trouble a few times.

 

They moved it to Evaluate Remove Output. Ctrl+Shift+R

This works.
 

restart

with(plots)

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(1)

c1 := x*y+x+y = 7

x*y+x+y = 7

(2)

c2 := x^2+x*y+y^2 = 13

x^2+x*y+y^2 = 13

(3)

implicitplot([c1, c2], x = -5 .. 5, y = -5 .. 5, colour = [blue, green])

 

sol := `assuming`([solve({c1, c2}, [x, y], useassumptions)], [0 < x and x < 4, 0 < y and y < 4])

[[x = 1, y = 3], [x = 3, y = 1]]

(4)

``


 

Download This_works.mw


Hi,

This really is just a more expanded version of vv 5208  answer.

restart

P := [x3, y3, z3]

[x3, y3, z3]

(1)

A := [x1, y1, z1]

[x1, y1, z1]

(2)

B := [x2, y2, z2]

[x2, y2, z2]

(3)

H lies on the line connecting AB, H can be defined as an affine combination of A and B. -∞ < λ < ∞. If 0 < λ < 1 then λ lies between A and B

 

H := simplify(expand((1-lambda)*A+lambda*B))

[(-x1+x2)*lambda+x1, (-y1+y2)*lambda+y1, (-z1+z2)*lambda+z1]

(4)

``

Get distance between P and H

distPH := sqrt((H[1]-P[1])^2+(H[2]-P[2])^2+(H[3]-P[3])^2)

(((-x1+x2)*lambda+x1-x3)^2+((-y1+y2)*lambda+y1-y3)^2+((-z1+z2)*lambda+z1-z3)^2)^(1/2)

(5)

Miniminist the distance by differentiating wrt λ. Then solve for λ

mdist := diff(distPH, lambda)

(1/2)*(2*((-x1+x2)*lambda+x1-x3)*(-x1+x2)+2*((-y1+y2)*lambda+y1-y3)*(-y1+y2)+2*((-z1+z2)*lambda+z1-z3)*(-z1+z2))/(((-x1+x2)*lambda+x1-x3)^2+((-y1+y2)*lambda+y1-y3)^2+((-z1+z2)*lambda+z1-z3)^2)^(1/2)

(6)

lambda := solve(mdist, lambda)

(x1^2-x1*x2-x1*x3+x2*x3+y1^2-y1*y2-y1*y3+y2*y3+z1^2-z1*z2-z1*z3+z2*z3)/(x1^2-2*x1*x2+x2^2+y1^2-2*y1*y2+y2^2+z1^2-2*z1*z2+z2^2)

(7)

Back substitute. This is the shortest possible distance  between P and H

simplify(distPH)

((x1^2*y2^2-2*x1^2*y2*y3+x1^2*y3^2+x1^2*z2^2-2*x1^2*z2*z3+x1^2*z3^2-2*x1*x2*y1*y2+2*x1*x2*y1*y3+2*x1*x2*y2*y3-2*x1*x2*y3^2-2*x1*x2*z1*z2+2*x1*x2*z1*z3+2*x1*x2*z2*z3-2*x1*x2*z3^2+2*x1*x3*y1*y2-2*x1*x3*y1*y3-2*x1*x3*y2^2+2*x1*x3*y2*y3+2*x1*x3*z1*z2-2*x1*x3*z1*z3-2*x1*x3*z2^2+2*x1*x3*z2*z3+x2^2*y1^2-2*x2^2*y1*y3+x2^2*y3^2+x2^2*z1^2-2*x2^2*z1*z3+x2^2*z3^2-2*x2*x3*y1^2+2*x2*x3*y1*y2+2*x2*x3*y1*y3-2*x2*x3*y2*y3-2*x2*x3*z1^2+2*x2*x3*z1*z2+2*x2*x3*z1*z3-2*x2*x3*z2*z3+x3^2*y1^2-2*x3^2*y1*y2+x3^2*y2^2+x3^2*z1^2-2*x3^2*z1*z2+x3^2*z2^2+y1^2*z2^2-2*y1^2*z2*z3+y1^2*z3^2-2*y1*y2*z1*z2+2*y1*y2*z1*z3+2*y1*y2*z2*z3-2*y1*y2*z3^2+2*y1*y3*z1*z2-2*y1*y3*z1*z3-2*y1*y3*z2^2+2*y1*y3*z2*z3+y2^2*z1^2-2*y2^2*z1*z3+y2^2*z3^2-2*y2*y3*z1^2+2*y2*y3*z1*z2+2*y2*y3*z1*z3-2*y2*y3*z2*z3+y3^2*z1^2-2*y3^2*z1*z2+y3^2*z2^2)/(x1^2-2*x1*x2+x2^2+y1^2-2*y1*y2+y2^2+z1^2-2*z1*z2+z2^2))^(1/2)

(8)

``

The coordinates to H

H

[(-x1+x2)*(x1^2-x1*x2-x1*x3+x2*x3+y1^2-y1*y2-y1*y3+y2*y3+z1^2-z1*z2-z1*z3+z2*z3)/(x1^2-2*x1*x2+x2^2+y1^2-2*y1*y2+y2^2+z1^2-2*z1*z2+z2^2)+x1, (-y1+y2)*(x1^2-x1*x2-x1*x3+x2*x3+y1^2-y1*y2-y1*y3+y2*y3+z1^2-z1*z2-z1*z3+z2*z3)/(x1^2-2*x1*x2+x2^2+y1^2-2*y1*y2+y2^2+z1^2-2*z1*z2+z2^2)+y1, (-z1+z2)*(x1^2-x1*x2-x1*x3+x2*x3+y1^2-y1*y2-y1*y3+y2*y3+z1^2-z1*z2-z1*z3+z2*z3)/(x1^2-2*x1*x2+x2^2+y1^2-2*y1*y2+y2^2+z1^2-2*z1*z2+z2^2)+z1]

(9)

``


 

Download Affine_Geometry.mw

Try this, I extended your list,

L1 := [{3, 5}, {4, 5}, {4, 8, 9}, {-7, 2, 3}]:
      
L2 := {};  #empty set
                            L2 := {}
for i to nops(L1) do
L2 := L1[i] union L2
end do;
                          L2 := {3, 5}
                        L2 := {3, 4, 5}
                     L2 := {3, 4, 5, 8, 9}
                  L2 := {-7, 2, 3, 4, 5, 8, 9}
 

Try   implicitplot(cos(x)*cosh(y) = 1, x = -3 .. 3, y = -5 .. 5, gridrefine=2).

You can set higher values for gridrefine   3,4,5

http://www.yorku.ca/marko/ComPhys/Euler/Euler.html

 

you would need to do your own animation though.

Also here in a question, I posted at the time @Rouben Rostamian    gave a quaternion solution.

https://www.mapleprimes.com/questions/221298-I-Am-Looking-For-A-rotate-Type-Command#answer236768

This is an animation I did from following the blog I mentioned in the previous reply. It shows the momentum vectors.


I changed your c:= to an "if then else end if".That stops producing the Error  But I could have intrepited your statement  incorrectly.

 

restart;

NULL

fdsolve := proc({gamma:=NULL, rho:=NULL, mu:=NULL, omega:=NULL, t0:=NULL,
                 t1:=NULL, x0:=NULL, y0:=NULL,
                 N:=NULL}, params)
    local t, h, c, b, x, y, L, n, l, X, Y, f, g, s1, s2, s3, s4, s5, s6, s7, s8, s9;
    eval(F(t,x,y), params);
    f := unapply(%, [t,x,y]);
    eval(G(t,x,y), params);
    g := unapply(%, [t,x,y]);
    L := floor(1/mu);
    h := (t1 - t0)/N;
s1:= sum(((omega*(h*(n-1))^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s2:= sum(((omega*(h*n)^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s3:= sum(((omega*(h*n)^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+1)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s4:= sum(((omega*(h*(n-i+1))^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s5:= sum(((omega*(h*(n-i-1))^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s6:= sum(((omega*(h*(n-i))^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s7:= sum(((omega*(h*(n-i))^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+1)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s8:= sum(((omega*(h*(n-i-1))^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+1)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);
s9:=sum(((omega*h^rho)^(j)*GAMMA(gamma+j))/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100);    
    c := (i,n) ->
        if i=0 then
              (h^mu)*(  ( ((n-1)^(mu+1))*s1 )-((n^(mu+1))*s2)+((n^(mu))*s3)  )else
              (h^mu)*( (((n-i+1)^(mu+1))*s4)+(((n-i-1)^(mu+1))*s5)-(2*((n-i)^(mu+1))*s6) )
        end if;

b := (i,n) -> (h^mu)*( ((n-i)^(mu)*s7)-((n-i-1)^(mu)*s8) );

    t := Array(0..N, i-> (1-i/N)*t0 + i/N*t1, datatype=float[8]);
    x[0], y[0] := x0, y0;                                           
    for n from 0 to N-1 do
        X[0], Y[0] :=
            x[0] + add(b(i,n+1)*f(t[i],x[i],y[i]), i=0..n),
            y[0] + add(b(i,n+1)*g(t[i],x[i],y[i]), i=0..n);
        for l from 1 to L do
            X[l], Y[l] :=
                x[0] + add(c(i,n+1)*f(t[i],x[i],y[i]), i=0..n)
                     + (h^mu)*s9*f(t[n+1], X[l-1], Y[l-1]),
                y[0] + add(c(i,n+1)*g(t[i],x[i],y[i]), i=0..n)
                     + (h^mu)*s9*g(t[n+1], X[l-1], Y[l-1]);
        end do;
        x[n+1], y[n+1] := X[L], Y[L];
        #printf("y[%d]=%a\n", n+1, y[n+1]);
    end do;
    return Array(0..N, i -> [t[i], x[i], y[i]]);
end proc

proc (params, { N := NULL, gamma := NULL, mu := NULL, omega := NULL, rho := NULL, t0 := NULL, t1 := NULL, x0 := NULL, y0 := NULL }) local t, h, c, b, x, y, L, n, l, X, Y, f, g, s1, s2, s3, s4, s5, s6, s7, s8, s9; eval(F(t, x, y), params); f := unapply(%, [t, x, y]); eval(G(t, x, y), params); g := unapply(%, [t, x, y]); L := floor(1/mu); h := (t1-t0)/N; s1 := sum((omega*(h*(n-1))^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s2 := sum((omega*(h*n)^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s3 := sum((omega*(h*n)^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+1)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s4 := sum((omega*(h*(n-i+1))^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s5 := sum((omega*(h*(n-i-1))^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s6 := sum((omega*(h*(n-i))^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s7 := sum((omega*(h*(n-i))^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+1)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s8 := sum((omega*(h*(n-i-1))^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+1)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); s9 := sum((omega*h^rho)^j*GAMMA(gamma+j)/(GAMMA(j*rho+mu+2)*factorial(j)*GAMMA(gamma)), j = 0 .. 100); c := proc (i, n) options operator, arrow; if i = 0 then h^mu*((n-1)^(mu+1)*s1-n^(mu+1)*s2+n^mu*s3) else h^mu*((n-i+1)^(mu+1)*s4+(n-i-1)^(mu+1)*s5-2*(n-i)^(mu+1)*s6) end if end proc; b := proc (i, n) options operator, arrow; h^mu*((n-i)^mu*s7-(n-i-1)^mu*s8) end proc; t := Array(0 .. N, proc (i) options operator, arrow; (1-i/N)*t0+i*t1/N end proc, datatype = float[8]); x[0], y[0] := x0, y0; for n from 0 to N-1 do X[0], Y[0] := x[0]+add(b(i, n+1)*f(t[i], x[i], y[i]), i = 0 .. n), y[0]+add(b(i, n+1)*g(t[i], x[i], y[i]), i = 0 .. n); for l to L do X[l], Y[l] := x[0]+add(c(i, n+1)*f(t[i], x[i], y[i]), i = 0 .. n)+h^mu*s9*f(t[n+1], X[l-1], Y[l-1]), y[0]+add(c(i, n+1)*g(t[i], x[i], y[i]), i = 0 .. n)+h^mu*s9*g(t[n+1], X[l-1], Y[l-1]) end do; x[n+1], y[n+1] := X[L], Y[L] end do; return Array(0 .. N, proc (i) options operator, arrow; [t[i], x[i], y[i]] end proc) end proc

(1)

 

 


 

Download _Prab-1.mw

If you want to some home study by yourself this is very good. Called Maths Foundation series.
 
https://www.youtube.com/user/njwildberger/playlists?view=50&shelf_id=10&sort=dd
 

Hello,

Dont know if this will help you or not. I posted the link below in March.

There are different definitions of the elliptic integrals used by various software packages. Without doing a couple of nights restudy I can't offer much else. Hope it helps.

https://www.mapleprimes.com/questions/221540-How-Do-I-Speed-Up-The-Evaluation-Of

 

 

180*evalf(FindAngle(p1, p2))/Pi

evalf evaluates acrcos to a decimal number in radians. 180/Pi converts radians to degrees.

Thy increasing the number of diditas displayed to 5 million and see what is that is ok.

Yes. Dr R Lopez posted this on the change in Maple 2017 http://www.mapleprimes.com/maplesoftblog/208309-Typesetting-And-Maple-2017

The Determinant to the Equations = 0 so the system cant be solved. Maybe you have an error.
 

restart

``

with(LinearAlgebra)

[`&x`, Add, Adjoint, BackwardSubstitute, BandMatrix, Basis, BezoutMatrix, BidiagonalForm, BilinearForm, CARE, CharacteristicMatrix, CharacteristicPolynomial, Column, ColumnDimension, ColumnOperation, ColumnSpace, CompanionMatrix, CompressedSparseForm, ConditionNumber, ConstantMatrix, ConstantVector, Copy, CreatePermutation, CrossProduct, DARE, DeleteColumn, DeleteRow, Determinant, Diagonal, DiagonalMatrix, Dimension, Dimensions, DotProduct, EigenConditionNumbers, Eigenvalues, Eigenvectors, Equal, ForwardSubstitute, FrobeniusForm, FromCompressedSparseForm, FromSplitForm, GaussianElimination, GenerateEquations, GenerateMatrix, Generic, GetResultDataType, GetResultShape, GivensRotationMatrix, GramSchmidt, HankelMatrix, HermiteForm, HermitianTranspose, HessenbergForm, HilbertMatrix, HouseholderMatrix, IdentityMatrix, IntersectionBasis, IsDefinite, IsOrthogonal, IsSimilar, IsUnitary, JordanBlockMatrix, JordanForm, KroneckerProduct, LA_Main, LUDecomposition, LeastSquares, LinearSolve, LyapunovSolve, Map, Map2, MatrixAdd, MatrixExponential, MatrixFunction, MatrixInverse, MatrixMatrixMultiply, MatrixNorm, MatrixPower, MatrixScalarMultiply, MatrixVectorMultiply, MinimalPolynomial, Minor, Modular, Multiply, NoUserValue, Norm, Normalize, NullSpace, OuterProductMatrix, Permanent, Pivot, PopovForm, ProjectionMatrix, QRDecomposition, RandomMatrix, RandomVector, Rank, RationalCanonicalForm, ReducedRowEchelonForm, Row, RowDimension, RowOperation, RowSpace, ScalarMatrix, ScalarMultiply, ScalarVector, SchurForm, SingularValues, SmithForm, SplitForm, StronglyConnectedBlocks, SubMatrix, SubVector, SumBasis, SylvesterMatrix, SylvesterSolve, ToeplitzMatrix, Trace, Transpose, TridiagonalForm, UnitVector, VandermondeMatrix, VectorAdd, VectorAngle, VectorMatrixMultiply, VectorNorm, VectorScalarMultiply, ZeroMatrix, ZeroVector, Zip]

(1)

``

eq1 := x[1]-x[2] = 0;

x[1]-x[2] = 0

(2)

eq2 := -x[1]+2*x[2]-x[3] = 0;

-x[1]+2*x[2]-x[3] = 0

(3)

eq3 := -x[2]+2*x[3]-x[4] = 0;

-x[2]+2*x[3]-x[4] = 0

(4)

eq4 := -x[3]+x[4]-t = 0;

-x[3]+x[4]-t = 0

(5)

M, v := GenerateMatrix({eq1, eq2, eq3, eq4}, [x[1], x[2], x[3], x[4]])

Matrix(%id = 18446744074805789630), Vector[column](%id = 18446744074805789510)

(6)

LinearSolve(M, v)

Error, (in LinearAlgebra:-LinearSolve) inconsistent system

 

LinearAlgebra:-Rank(M)

4

(7)

GaussianElimination(M)

Matrix(%id = 18446744074805811910)

(8)

LinearAlgebra:-Determinant(M)

0

(9)

``


 

Download Eqns-1.mw


This Is how I would approach the issue. Could be a problem if l=1 or n.

restart

``

C := (sum(A[k]*x[i, k], k = 1 .. l-1)+sum(A[k]*x[i, k], k = l+1 .. n)+A[l]*x[i, l])^2-(2*(sum(A[k]*x[i, k], k = 1 .. l-1)+sum(A[k]*x[i, k], k = l+1 .. n)+A[l]*x[i, l]))*y[i]+y[i]^2

(sum(A[k]*x[i, k], k = 1 .. l-1)+sum(A[k]*x[i, k], k = l+1 .. n)+A[l]*x[i, l])^2-2*(sum(A[k]*x[i, k], k = 1 .. l-1)+sum(A[k]*x[i, k], k = l+1 .. n)+A[l]*x[i, l])*y[i]+y[i]^2

(1)

diff(C, A[l])

2*(sum(A[k]*x[i, k], k = 1 .. l-1)+sum(A[k]*x[i, k], k = l+1 .. n)+A[l]*x[i, l])*x[i, l]-2*x[i, l]*y[i]

(2)

``


Download diff_sum.mw

 

 

5 6 7 8 Page 7 of 8