tomleslie

13876 Reputation

20 Badges

15 years, 167 days

MaplePrimes Activity


These are answers submitted by tomleslie

It seems possible to modify my original code to come up with solutions fors all values of the parameter 'ax' between 0 and 1 in steps of 0.1, with the exceptions of ax=0.2 and 0.3. At the momentI can't really see why these two parameter values are "special",

As Carl has pointed out, ther fact that the 'boundaries' of the problem change with the value of the parameter 'ax' means that a solution for a given value of 'ax' cannot be used as an 'approxsoln' for a (slightly) different value of 'ax' - which is seriously annoying, because I feel that this approach ought to be the best method of obtaining all solutions.

Anyhow, for what it is worth the attached shows solutions for ax=0, 0.1, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 - but, as noted above, not ax=0.2 or 0.3. I'll probably look at this again tomorrow, because it is annoyingly incomplete - but right now, it is past my bedtime

restart; with(plots)

fcns := {f(x), g(x), t(x)}

m := .2; pa := 3.14*(1/3); aa := .1; bb := .3; ta := .2; kt := .4; h2 := 1+m*ax+bb*sin((2*3.14)*(ax-ta)); h1 := -1-m*ax-aa*sin((2*3.14)*(ax-ta)+pa); a2 := kt+aa*sin((2*3.14)*(ax-ta))+bb*sin((2*3.14)*(ax-ta)+pa)

1+.2*ax+.3*sin(6.28*ax-1.256)

 

-1-.2*ax-.1*sin(6.28*ax-.209333333)

 

.4+.1*sin(6.28*ax-1.256)+.3*sin(6.28*ax-.209333333)

(1)

eq1 := 1.5*(diff(f(x), `$`(x, 4)))-.40*alpha*(diff((diff(f(x), `$`(x, 2)))^3, `$`(x, 2)))-.20*(diff(f(x), `$`(x, 2)))+.20*(diff(t(x), `$`(x, 1)))+.20*(diff(g(x), `$`(x, 1))) = 0

1.5*(diff(diff(diff(diff(f(x), x), x), x), x))-.40*alpha*(6*(diff(diff(f(x), x), x))*(diff(diff(diff(f(x), x), x), x))^2+3*(diff(diff(f(x), x), x))^2*(diff(diff(diff(diff(f(x), x), x), x), x)))-.20*(diff(diff(f(x), x), x))+.20*(diff(t(x), x))+.20*(diff(g(x), x)) = 0

(2)

eq2 := 1.75*(diff(t(x), `$`(x, 2)))+(diff(t(x), `$`(x, 1)))*(diff(g(x), `$`(x, 1)))+2*(diff(t(x), `$`(x, 1)))^2+.7*((diff(f(x), `$`(x, 2)))^2-(diff(f(x), `$`(x, 2)))^4)+.1*(diff(f(x), `$`(x, 1)))^2+.1*t(x) = 0

1.75*(diff(diff(t(x), x), x))+(diff(t(x), x))*(diff(g(x), x))+2*(diff(t(x), x))^2+.7*(diff(diff(f(x), x), x))^2-.7*(diff(diff(f(x), x), x))^4+.1*(diff(f(x), x))^2+.1*t(x) = 0

(3)

eq3 := diff(g(x), `$`(x, 2))+2*(diff(t(x), `$`(x, 2)))-.5*g(x) = 0

diff(diff(g(x), x), x)+2*(diff(diff(t(x), x), x))-.5*g(x) = 0

(4)

bc := f(h2) = (1/2)*a2, (D(f))(h2) = 0, f(h1) = -(1/2)*a2, (D(f))(h1) = 0, t(h2) = 1, t(h1) = 0, g(h2) = 1, g(h1) = 0

#
# Generate solution for values of 'ax' in the
# range 0..1 in step of 0.1, with the exceptions
# of ax=0.2 and ax=0.3 - which (for reasons I can't
# figure out) cause problems
#
  L:= {seq(j, j=0..1,0.1)} minus {0.2, 0.3}:
  NN := nops(L):
  for k from 1 to NN do
      R[L[k]]:= dsolve(eval({bc, eq1,eq2,eq3}, ax= L[k]), fcns, type = numeric, maxmesh=8192, continuation=alpha);
#
# Following command implies OP wants to know
#
# diff(f(x),x,x) evaluated at x=0
#
# No idea why this is significant - but if that
# is what is desired .......
#
      X1[L[k]]:=rhs(R[L[k]](0)[4]);
  end do:
  X1();

(table( [( 0 ) = HFloat(-0.05557762876500369), ( 1.0 ) = HFloat(-0.017171480659153533), ( .9 ) = HFloat(0.009351354877967916), ( .7 ) = HFloat(0.030550873809413508), ( .4 ) = HFloat(0.08101427896313536), ( .5 ) = HFloat(0.07979119754305927), ( .8 ) = HFloat(0.0203707660453545), ( .1 ) = HFloat(-0.05163148013079051), ( .6 ) = HFloat(0.056692609057450084) ] ))()

(5)

#
# Plot the obtained solutions - ie all curves except for
# those where ax=0.2 or 0.3. These curves *seem* to vary
# in a reasonably 'smooth' way so not obvious why solutions
# for ax=0.2,0.3 are "unobtainable"
#
  interface(warnlevel=0);
  display( [ seq( odeplot( R[L[k]],
                           [[x, f(x)], [x, g(x)], [x, t(x)]],
                           x = -1 .. 1
                         ),
                  k=1..NN
                )
           ]
         );
  interface(warnlevel=3);

3

 

 

0

(6)

#
# OP *seems* to want to know diff(f(x),x,x) at x=0.
# So plot these values as a function of the parameter
# 'ax'
#
  plot( [indices(X1, nolist)],
        [entries(X1, nolist)],
        style=point,
        symbol=solidcircle,
        symbolsize=20
      )

 

 

Download odeCont2.mw

 

The attached obtains the solution to your original problem, by using a continuation method, with continuation variable 'alpha'

There are then two possible strategies to obtain solutions for other values of the parameter 'ax'. Either

  • keep using the continuation method, or
  • as each solution is obtained, use it as the 'approxsoln' for further values of 'ax'

It is not obvious which is likely to be the more successful approach probably best to treat this as an "experimental science" - aka "suck it and see"

restart; with(plots)

fcns := {f(x), g(x), t(x)}

m := .2; pa := 3.14*(1/3); aa := .1; bb := .3; ta := .2; kt := .4; h2 := 1+m*ax+bb*sin((2*3.14)*(ax-ta)); h1 := -1-m*ax-aa*sin((2*3.14)*(ax-ta)+pa); a2 := kt+aa*sin((2*3.14)*(ax-ta))+bb*sin((2*3.14)*(ax-ta)+pa)

1+.2*ax+.3*sin(6.28*ax-1.256)

 

-1-.2*ax-.1*sin(6.28*ax-.209333333)

 

.4+.1*sin(6.28*ax-1.256)+.3*sin(6.28*ax-.209333333)

(1)

eq1 := 1.5*(diff(f(x), `$`(x, 4)))-.40*alpha*(diff((diff(f(x), `$`(x, 2)))^3, `$`(x, 2)))-.20*(diff(f(x), `$`(x, 2)))+.20*(diff(t(x), `$`(x, 1)))+.20*(diff(g(x), `$`(x, 1))) = 0

1.5*(diff(diff(diff(diff(f(x), x), x), x), x))-.40*alpha*(6*(diff(diff(f(x), x), x))*(diff(diff(diff(f(x), x), x), x))^2+3*(diff(diff(f(x), x), x))^2*(diff(diff(diff(diff(f(x), x), x), x), x)))-.20*(diff(diff(f(x), x), x))+.20*(diff(t(x), x))+.20*(diff(g(x), x)) = 0

(2)

eq2 := 1.75*(diff(t(x), `$`(x, 2)))+(diff(t(x), `$`(x, 1)))*(diff(g(x), `$`(x, 1)))+2*(diff(t(x), `$`(x, 1)))^2+.7*((diff(f(x), `$`(x, 2)))^2-(diff(f(x), `$`(x, 2)))^4)+.1*(diff(f(x), `$`(x, 1)))^2+.1*t(x) = 0

1.75*(diff(diff(t(x), x), x))+(diff(t(x), x))*(diff(g(x), x))+2*(diff(t(x), x))^2+.7*(diff(diff(f(x), x), x))^2-.7*(diff(diff(f(x), x), x))^4+.1*(diff(f(x), x))^2+.1*t(x) = 0

(3)

eq3 := diff(g(x), `$`(x, 2))+2*(diff(t(x), `$`(x, 2)))-.5*g(x) = 0

diff(diff(g(x), x), x)+2*(diff(diff(t(x), x), x))-.5*g(x) = 0

(4)

bc := f(h2) = (1/2)*a2, (D(f))(h2) = 0, f(h1) = -(1/2)*a2, (D(f))(h1) = 0, t(h2) = 1, t(h1) = 0, g(h2) = 1, g(h1) = 0

f(1+.2*ax+.3*sin(6.28*ax-1.256)) = .2000000000+0.5000000000e-1*sin(6.28*ax-1.256)+.1500000000*sin(6.28*ax-.209333333), (D(f))(1+.2*ax+.3*sin(6.28*ax-1.256)) = 0, f(-1-.2*ax-.1*sin(6.28*ax-.209333333)) = -.2000000000-0.5000000000e-1*sin(6.28*ax-1.256)-.1500000000*sin(6.28*ax-.209333333), (D(f))(-1-.2*ax-.1*sin(6.28*ax-.209333333)) = 0, t(1+.2*ax+.3*sin(6.28*ax-1.256)) = 1, t(-1-.2*ax-.1*sin(6.28*ax-.209333333)) = 0, g(1+.2*ax+.3*sin(6.28*ax-1.256)) = 1, g(-1-.2*ax-.1*sin(6.28*ax-.209333333)) = 0

(5)

L := [.1]; AP := NULL; NN := nops(L); for k to NN do R := dsolve(eval({bc, eq1, eq2, eq3}, ax = L[k]), fcns, type = numeric, maxmesh = 1024, method = bvp[midrich], continuation = alpha); AP := approxsoln = R; X1 || k := rhs(R(0)[4]) end do; ba3 := [(X1 || (1 .. NN))(0)]; plots:-odeplot(R, [[x, f(x)], [x, g(x)], [x, t(x)]], x = -1 .. 1)

[.1]

 

1

 

[HFloat(-0.05163148011836605)]

 

Warning, right boundary of range exceeds domain of the problem, it has been adjusted

 

 

``

Download odeCont.mw

 

  f:=(x,y)-> evalc~(eval~([ abs(z - 1) > 1, abs(z + 1) > 1, Im(z) > 0], z=x+I*y)):
  plots:-inequal(f(x,y), x=-5..5, y=-5..5);

 

 


 

Download cplexReg.mw

Admittedly I'm using 64-bit Windows 7. See the attached

Consider uploading the "crashing" worksheet using the big green up-arrow in the Mapleprimes toolbar, just in case something like a "hidden" character has sneaked into your expressions

  restart;
  PV := 1000.00;
  C := 250;
  eq2 := PV = C*sum(1/(1 + r)^(15.5/365 + k/12), k = 1 .. 12);
  fsolve(eq2, r);

1000.00

 

250

 

1000.00 = 250/(1.+r)^(18869863013/150000000000)+250/(1.+r)^(31369863013/150000000000)+250/(1.+r)^(14623287671/50000000000)+250/(1.+r)^(56369863013/150000000000)+250/(1.+r)^(68869863013/150000000000)+250/(1.+r)^(27123287671/50000000000)+250/(1.+r)^(93869863013/150000000000)+250/(1.+r)^(106369863013/150000000000)+250/(1.+r)^(39623287671/50000000000)+250/(1.+r)^(131369863013/150000000000)+250/(1.+r)^(143869863013/150000000000)+250/(1.+r)^(52123287671/50000000000)

 

8.161501788

(1)

#
# Should probably be using 'add()' rather than 'sum()'
# as in
#
  restart;
  PV := 1000.00;
  C := 250;
  eq2 := PV = C*add(1/(1 + r)^(15.5/365 + k/12), k = 1 .. 12);
  fsolve(eq2, r);

1000.00

 

250

 

1000.00 = 250/(1+r)^.1257990868+250/(1+r)^.2091324201+250/(1+r)^.2924657534+250/(1+r)^.3757990867+250/(1+r)^.4591324201+250/(1+r)^.5424657534+250/(1+r)^.6257990867+250/(1+r)^.7091324201+250/(1+r)^.7924657534+250/(1+r)^.8757990867+250/(1+r)^.9591324201+250/(1+r)^1.042465753

 

8.161501789

(2)

restart; PV := 1000.00; C := 250.00; eq2 := PV = C*(sum(1/(1+r)^(15.5*(1/365)+(1/12)*k), k = 1 .. 12)); fsolve(eq2, r)

1000.00

 

250.00

 

1000.00 = 250.00/(1.+r)^(18869863013/150000000000)+250.00/(1.+r)^(31369863013/150000000000)+250.00/(1.+r)^(14623287671/50000000000)+250.00/(1.+r)^(56369863013/150000000000)+250.00/(1.+r)^(68869863013/150000000000)+250.00/(1.+r)^(27123287671/50000000000)+250.00/(1.+r)^(93869863013/150000000000)+250.00/(1.+r)^(106369863013/150000000000)+250.00/(1.+r)^(39623287671/50000000000)+250.00/(1.+r)^(131369863013/150000000000)+250.00/(1.+r)^(143869863013/150000000000)+250.00/(1.+r)^(52123287671/50000000000)

 

8.161501788

(3)

restart; PV := 1000.00; C := 250.00; eq2 := PV = C*add(1/(1+r)^(15.5*(1/365)+(1/12)*k), k = 1 .. 12); fsolve(eq2, r)

1000.00

 

250.00

 

1000.00 = 250.00/(1+r)^.1257990868+250.00/(1+r)^.2091324201+250.00/(1+r)^.2924657534+250.00/(1+r)^.3757990867+250.00/(1+r)^.4591324201+250.00/(1+r)^.5424657534+250.00/(1+r)^.6257990867+250.00/(1+r)^.7091324201+250.00/(1+r)^.7924657534+250.00/(1+r)^.8757990867+250.00/(1+r)^.9591324201+250.00/(1+r)^1.042465753

 

8.161501789

(4)

 


 

Download cantRep.mw

the only thing I have heard referred to as the "Maple Programming Toolbox" was an add-on for Matlab. You bought Matlab, and then you paid extra for all sorts of add-ons whihc Matlab called "toolboxes". One of these addons for Matlab was the capability to do symbolic math computations using the Maple toolbox

Originally, Matlab was "numerics-only" so any kind of symbolic maths was impossible.. Matlab-makers fixed this problem by licensing (part of) Maple software so that you could do "symbolic" maths within Matlab. Unfortunately Matlab and Maple had a bit of a bust-up, and Matlab decided to offer a "different" symbolic math toolbox - I think their current option is essentially MuPad, but I might be wrong.

Because the Maple/Matlab link-up lasted for several years, and neither company really wanted to upset the user base by rendering previously written code unusable, it is still posible to use Maple as a symbolic toolbox within Matlab. Neither company really advertises this fact

 

is shown in the attached

 eq:=x^2+2*x-1=0;
 solve(eq,[x])[];

x^2+2*x-1 = 0

 

[x = 2^(1/2)-1], [x = -1-2^(1/2)]

(1)

 

Download eqSol.mw

would probably be like

  restart;
  with(LinearAlgebra):

  diagSqSum:= (mat::Matrix)-> add(Diagonal(mat)^~2):

  M1:= RandomMatrix(10);
  diagSqSum(M1);

 

just because I like alternatives.

This uses the free DirectSearch() package from the Maple Application Centre, available here

https://www.maplesoft.com/applications/view.aspx?SID=101333

restart;
sol:=DirectSearch:-SolveEquations( [ x^3*y=1, y-sin(12*x)=0],
                                   [ x>1.2, x<2],
                                   AllSolutions=true
                                 );

Matrix(3, 4, {(1, 1) = 0.2062874040e-25, (1, 2) = Vector(2, {(1) = 0.1094679902e-12, (2) = -0.9298117831e-13}), (1, 3) = [x = 1.2660583429041916, y = .4927638522060825], (1, 4) = 129, (2, 1) = 0.4541627045e-24, (2, 2) = Vector(2, {(1) = 0.6739053759e-12, (2) = 0.3774758284e-14}), (2, 3) = [x = 1.591679996766617, y = .2479891756149561], (2, 4) = 87, (3, 1) = 0.7352588795e-22, (3, 2) = Vector(2, {(1) = -0.5577649453e-11, (2) = -0.6512734796e-11}), (3, 3) = [x = 1.8186778594099653, y = .16623890164935765], (3, 4) = 95})

(1)

 

Download amotherDS.mw

 

on the nature of the quantity 'A' - some kind of table/matrix maybe?

First of all I suggest that you read the help page for the 'op()' command, and maybe consider the example in the attached

  restart;

  A:=LinearAlgebra:-RandomMatrix(8,2)

Matrix(8, 2, {(1, 1) = -93, (1, 2) = 8, (2, 1) = -76, (2, 2) = 69, (3, 1) = -72, (3, 2) = 99, (4, 1) = -2, (4, 2) = 29, (5, 1) = -32, (5, 2) = 44, (6, 1) = -74, (6, 2) = 92, (7, 1) = -4, (7, 2) = -31, (8, 1) = 27, (8, 2) = 67})

(1)

#
# So how does Maple represent this matrix internally.
#
# First show all of its operands
#
  op([0..-1],A);

Matrix, 8, 2, {(1, 1) = -93, (1, 2) = 8, (2, 1) = -76, (2, 2) = 69, (3, 1) = -72, (3, 2) = 99, (4, 1) = -2, (4, 2) = 29, (5, 1) = -32, (5, 2) = 44, (6, 1) = -74, (6, 2) = 92, (7, 1) = -4, (7, 2) = -31, (8, 1) = 27, (8, 2) = 67}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []

(2)

#
# Now select the second operand of A
#
  op(2,A);

{(1, 1) = -93, (1, 2) = 8, (2, 1) = -76, (2, 2) = 69, (3, 1) = -72, (3, 2) = 99, (4, 1) = -2, (4, 2) = 29, (5, 1) = -32, (5, 2) = 44, (6, 1) = -74, (6, 2) = 92, (7, 1) = -4, (7, 2) = -31, (8, 1) = 27, (8, 2) = 67}

(3)

#
# Select the first operand from within the second operand
#
  op([2,1],A);

(1, 1) = -93

(4)

#
# Select the second operand from within the first operand of A
# from withing the second operand
#
  op([2,1,2],A);

-93

(5)

#
# So for the above Matrix A the three view range options
# would return
#
  0..op([2, 1, 2], A);
  0..op([2, 2, 2], A);
   min(0, A[..,2] )..max(A[..,2]);

0 .. -93

 

0 .. 8

 

-31 .. 99

(6)

 

Download ops.mw

Just solving the system in your original worksheet is pretty trivial - see the attached


 

restart;

eqs := diff(q(y), y, y) - A*q(y) = B*(P*y + c1),
       (1 + N)*diff(u(y), y, y) + N*diff(q(y), y) = P;
bcs := q(-sigma) = 0, q(sigma) = 0,
       u(-sigma) = 1, u(sigma) = -k;

diff(diff(q(y), y), y)-A*q(y) = B*(P*y+c1), (1+N)*(diff(diff(u(y), y), y))+N*(diff(q(y), y)) = P

 

q(-sigma) = 0, q(sigma) = 0, u(-sigma) = 1, u(sigma) = -k

(1)

  simplify~
  ( convert~
    ( dsolve
      ( [eqs, bcs],
        [q(y), u(y)]
      ),
      trigh
    )
  );

{q(y) = -B*(((P*y+c1)*sinh(A^(1/2)*sigma)-sinh(A^(1/2)*y)*P*sigma)*cosh(A^(1/2)*sigma)-cosh(A^(1/2)*y)*sinh(A^(1/2)*sigma)*c1)/(A*cosh(A^(1/2)*sigma)*sinh(A^(1/2)*sigma)), u(y) = (1/2)*(2*N*B*(P*sigma^2+c1*y)*cosh(A^(1/2)*sigma)^2+(((-P*sigma^3+((-k+1)*N+P*y^2-k+1)*sigma-y*(k+1)*(1+N))*A^(3/2)+A^(1/2)*B*N*P*sigma*(-sigma+y)*(sigma+y))*sinh(A^(1/2)*sigma)-2*B*N*cosh(A^(1/2)*y)*P*sigma^2)*cosh(A^(1/2)*sigma)-2*B*N*c1*(sinh(A^(1/2)*y)*sinh(A^(1/2)*sigma)*sigma+y))/(A^(3/2)*(1+N)*sigma*cosh(A^(1/2)*sigma)*sinh(A^(1/2)*sigma))}

(2)

 

 


 

Download odeSols.mw

 

In the attached, I have reproduced your calculations in a somewhat more organised and systematic way.

The worksheet reproduces the answers which you have already obtained

This suggests that your problem is not really a "Maple issue", but something wrong with the logic of your calculation - in other words it is a case of "garbage in = garbage out"

Anyhow, for what it is worth, you might want to read the comments in the attached very carefully

  restart;

  with(LinearAlgebra):
#
# increase 'rtablesiz' so that all entries
# in matrices will display
#
  interface(rtablesize=12):
#
# Decrease the display precision, for more
# compact output. Doesn't affect the accuracy
# with which calculations are performed, just
# helps to keep the output display a bit more
# "compact'
#
  interface(displayprecision=4):

#
# Specify some parameters
#
  L:= 1: x_1:= 4.8231: a_L:= 0.25:
  b_L:= 0.25: c_L:= 0.5:

#
# Define a 12*12 matrix - no idea where this comes
# from (or what it means)
#
  M1:= Matrix
       ( 12,
         [ [0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
           [-1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
           [sin(S_1), cos(S_1), sinh(S_1), cosh(S_1), 0, 0, 0, 0, 0, 0, 0, 0],
           [cos(S_1), -sin(S_1), cosh(S_1), sinh(S_1), -cos(S_1), sin(S_1), -cosh(S_1), -sinh(S_1), 0, 0, 0, 0],
           [-sin(S_1), -cos(S_1), sinh(S_1), cosh(S_1), sin(S_1), cos(S_1), -sinh(S_1), -cosh(S_1), 0, 0, 0, 0],
           [-cos(S_1), sin(S_1), cosh(S_1), sinh(S_1), cos(S_1), -sin(S_1), -cosh(S_1), -sinh(S_1), 0, 0, 0, 0],
           [0, 0, 0, 0, sin(S_2), cos(S_2), sinh(S_2), cosh(S_2), 0, 0, 0, 0],
           [0, 0, 0, 0, cos(S_2), -sin(S_2), cosh(S_2), sinh(S_2), -cos(S_2), sin(S_2), -cosh(S_2), -sinh(S_2)],
           [0, 0, 0, 0, -sin(S_2), -cos(S_2), sinh(S_2), cosh(S_2), sin(S_2), cos(S_2), -sinh(S_2), -cosh(S_2)],
           [0, 0, 0, 0, -cos(S_2), sin(S_2), cosh(S_2), sinh(S_2), cos(S_2), -sin(S_2), -cosh(S_2), -sinh(S_2)],
           [0, 0, 0, 0, 0, 0, 0, 0, -sin(S_3), -cos(S_3), sinh(S_3), cosh(S_3)],
           [0, 0, 0, 0, 0, 0, 0, 0, -cos(S_3), sin(S_3), cosh(S_3), sinh(S_3)]
         ]
       );

Matrix(12, 12, {(1, 1) = 0, (1, 2) = -1, (1, 3) = 0, (1, 4) = 1, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (1, 10) = 0, (1, 11) = 0, (1, 12) = 0, (2, 1) = -1, (2, 2) = 0, (2, 3) = 1, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (2, 10) = 0, (2, 11) = 0, (2, 12) = 0, (3, 1) = sin(S_1), (3, 2) = cos(S_1), (3, 3) = sinh(S_1), (3, 4) = cosh(S_1), (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 0, (3, 10) = 0, (3, 11) = 0, (3, 12) = 0, (4, 1) = cos(S_1), (4, 2) = -sin(S_1), (4, 3) = cosh(S_1), (4, 4) = sinh(S_1), (4, 5) = -cos(S_1), (4, 6) = sin(S_1), (4, 7) = -cosh(S_1), (4, 8) = -sinh(S_1), (4, 9) = 0, (4, 10) = 0, (4, 11) = 0, (4, 12) = 0, (5, 1) = -sin(S_1), (5, 2) = -cos(S_1), (5, 3) = sinh(S_1), (5, 4) = cosh(S_1), (5, 5) = sin(S_1), (5, 6) = cos(S_1), (5, 7) = -sinh(S_1), (5, 8) = -cosh(S_1), (5, 9) = 0, (5, 10) = 0, (5, 11) = 0, (5, 12) = 0, (6, 1) = -cos(S_1), (6, 2) = sin(S_1), (6, 3) = cosh(S_1), (6, 4) = sinh(S_1), (6, 5) = cos(S_1), (6, 6) = -sin(S_1), (6, 7) = -cosh(S_1), (6, 8) = -sinh(S_1), (6, 9) = 0, (6, 10) = 0, (6, 11) = 0, (6, 12) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = sin(S_2), (7, 6) = cos(S_2), (7, 7) = sinh(S_2), (7, 8) = cosh(S_2), (7, 9) = 0, (7, 10) = 0, (7, 11) = 0, (7, 12) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = cos(S_2), (8, 6) = -sin(S_2), (8, 7) = cosh(S_2), (8, 8) = sinh(S_2), (8, 9) = -cos(S_2), (8, 10) = sin(S_2), (8, 11) = -cosh(S_2), (8, 12) = -sinh(S_2), (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = -sin(S_2), (9, 6) = -cos(S_2), (9, 7) = sinh(S_2), (9, 8) = cosh(S_2), (9, 9) = sin(S_2), (9, 10) = cos(S_2), (9, 11) = -sinh(S_2), (9, 12) = -cosh(S_2), (10, 1) = 0, (10, 2) = 0, (10, 3) = 0, (10, 4) = 0, (10, 5) = -cos(S_2), (10, 6) = sin(S_2), (10, 7) = cosh(S_2), (10, 8) = sinh(S_2), (10, 9) = cos(S_2), (10, 10) = -sin(S_2), (10, 11) = -cosh(S_2), (10, 12) = -sinh(S_2), (11, 1) = 0, (11, 2) = 0, (11, 3) = 0, (11, 4) = 0, (11, 5) = 0, (11, 6) = 0, (11, 7) = 0, (11, 8) = 0, (11, 9) = -sin(S_3), (11, 10) = -cos(S_3), (11, 11) = sinh(S_3), (11, 12) = cosh(S_3), (12, 1) = 0, (12, 2) = 0, (12, 3) = 0, (12, 4) = 0, (12, 5) = 0, (12, 6) = 0, (12, 7) = 0, (12, 8) = 0, (12, 9) = -cos(S_3), (12, 10) = sin(S_3), (12, 11) = cosh(S_3), (12, 12) = sinh(S_3)})

(1)

#
# One thing which the OP does is to substitute some "simple"
# functions of the unknown 'x' into the above matrix, and then
# plots the determinant of the result.
#
# No idea what the significance of this plot is: but for what
# it is worth - let's do it anyway
#
  plot
  ( Determinant
    ( eval
      ( M1,
        [ S_1 = x*L*a_L,
          S_2 = x*L*(a_L + b_L),
          S_3 = x*L*(a_L + b_L + c_L)
        ]
      )
    ),
    x=0..2*Pi
  );

 

###################################################################
#                                                                 #
# The following calculation makes no real sense to me at all, but #
# this reproduces the OP's worksheet hopefully in a somewhat      #
# clearer manner                                                  #
#                                                                 #
###################################################################

#
# Evaluate the above matrix with the unknowns S_1,
# S_2 and S_3 expressed in terms of parameter values
# defined earlier
#
# This is the same substitution as used in computation of the
# determinant above with the exception that  rather than using
# an unknown variable 'x', it uses the parameter x_1, with a
# value of 4.8231. (No idea where this value of 4,8321 comes from!!)
#
  M2:= eval( M1,
             [ S_1 = x_1*L*a_L,
               S_2 = x_1*L*(a_L + b_L),
               S_3 = x_1*L*(a_L + b_L + c_L)
             ]
           );

Matrix(12, 12, {(1, 1) = 0, (1, 2) = -1, (1, 3) = 0, (1, 4) = 1, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (1, 10) = 0, (1, 11) = 0, (1, 12) = 0, (2, 1) = -1, (2, 2) = 0, (2, 3) = 1, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (2, 10) = 0, (2, 11) = 0, (2, 12) = 0, (3, 1) = .9341, (3, 2) = .3570, (3, 3) = 1.5199, (3, 4) = 1.8194, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 0, (3, 10) = 0, (3, 11) = 0, (3, 12) = 0, (4, 1) = .3570, (4, 2) = -.9341, (4, 3) = 1.8194, (4, 4) = 1.5199, (4, 5) = -.3570, (4, 6) = .9341, (4, 7) = -1.8194, (4, 8) = -1.5199, (4, 9) = 0, (4, 10) = 0, (4, 11) = 0, (4, 12) = 0, (5, 1) = -.9341, (5, 2) = -.3570, (5, 3) = 1.5199, (5, 4) = 1.8194, (5, 5) = .9341, (5, 6) = .3570, (5, 7) = -1.5199, (5, 8) = -1.8194, (5, 9) = 0, (5, 10) = 0, (5, 11) = 0, (5, 12) = 0, (6, 1) = -.3570, (6, 2) = .9341, (6, 3) = 1.8194, (6, 4) = 1.5199, (6, 5) = .3570, (6, 6) = -.9341, (6, 7) = -1.8194, (6, 8) = -1.5199, (6, 9) = 0, (6, 10) = 0, (6, 11) = 0, (6, 12) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = .6669, (7, 6) = -.7451, (7, 7) = 5.5308, (7, 8) = 5.6205, (7, 9) = 0, (7, 10) = 0, (7, 11) = 0, (7, 12) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = -.7451, (8, 6) = -.6669, (8, 7) = 5.6205, (8, 8) = 5.5308, (8, 9) = .7451, (8, 10) = .6669, (8, 11) = -5.6205, (8, 12) = -5.5308, (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = -.6669, (9, 6) = .7451, (9, 7) = 5.5308, (9, 8) = 5.6205, (9, 9) = .6669, (9, 10) = -.7451, (9, 11) = -5.5308, (9, 12) = -5.6205, (10, 1) = 0, (10, 2) = 0, (10, 3) = 0, (10, 4) = 0, (10, 5) = .7451, (10, 6) = .6669, (10, 7) = 5.6205, (10, 8) = 5.5308, (10, 9) = -.7451, (10, 10) = -.6669, (10, 11) = -5.6205, (10, 12) = -5.5308, (11, 1) = 0, (11, 2) = 0, (11, 3) = 0, (11, 4) = 0, (11, 5) = 0, (11, 6) = 0, (11, 7) = 0, (11, 8) = 0, (11, 9) = .9939, (11, 10) = -.1105, (11, 11) = 62.1710, (11, 12) = 62.1790, (12, 1) = 0, (12, 2) = 0, (12, 3) = 0, (12, 4) = 0, (12, 5) = 0, (12, 6) = 0, (12, 7) = 0, (12, 8) = 0, (12, 9) = -.1105, (12, 10) = -.9939, (12, 11) = 62.1790, (12, 12) = 62.1710})

(2)

#
# No more matrices to display so reset the display precisiion
#
  interface(displayprecision=-1):

#
# Idle curiosity (the OP doesn't do this in his original worksheet)
# but what happens if one looks for a solution of the complete
# linear system, defined by the above matrix M2 - solutions
# are identically zero - no idea if this is significant or not
#
  LinearSolve( M2, Vector(12, fill=0));

Vector(12, {(1) = -0., (2) = -0., (3) = 0., (4) = -0., (5) = -0., (6) = -0., (7) = 0., (8) = 0., (9) = 0., (10) = -0., (11) = -0., (12) = 0.})

(3)

#
# This is where it gets really weird. Rather than solving the
# complete 12 X 12 matrix M2 (whihc as shown above would be
# identically zero), the OP extracts the first eleven rows of
# the matrix M2, and uses this as a 12*11 coefficient matrix,
# and solves the matrix equation
#
#      M2[1..11,1..12] . x[1..11] = b[1..11]
#
# for the vector 'x', with the vector 'b' being identically 0
#
# Note that since the coefficient matrix is 11 X 12, the 11-element
# solution vector will contain a 'free' parameter
#
  sol:=LinearSolve( M2[1..11,..], Vector(11, fill=0));
 

Vector(12, {(1) = .10144366371771879*_t0[1], (2) = -.11438703694640917*_t0[1], (3) = .10144366371771879*_t0[1], (4) = -.11438703694640917*_t0[1], (5) = 0.709513414043042e-1*_t0[1], (6) = -.12603957118214704*_t0[1], (7) = .15105911639526973*_t0[1], (8) = -.1737777468223752*_t0[1], (9) = .21022728290544188*_t0[1], (10) = -.2816561313410131*_t0[1], (11) = -1.0039906216693695*_t0[1], (12) = _t0[1]})

(4)

#
# The OP seems to want the coefficients of the 'free' parameter in
# the above solution. Then taking these coefficients in blocks
# of four, use these to multiply a Vector of functions of x to
# generate some expressions which don't seem to bear much relation to
# anything which has gone before??!
#
   terms:= Vector( [ sin(x_1*x), cos(x_1*x), sinh(x_1*x), cosh(x_1*x)]):
   pltEqs:= Vector( [ seq( Transpose(sol/~indets(sol)[])[j..j+3].terms,
                          j=1..9, 4
                        )
                   ]
                 );
#
# But plot them anyway
#
   plot( convert(pltEqs,list),
         x = 0 .. 1,
         color = [blue, green, red]
       );

Vector(3, {(1) = .10144366371771879*sin(4.8231*x)-.11438703694640917*cos(4.8231*x)+.10144366371771879*sinh(4.8231*x)-.11438703694640917*cosh(4.8231*x), (2) = 0.709513414043042e-1*sin(4.8231*x)-.12603957118214704*cos(4.8231*x)+.15105911639526973*sinh(4.8231*x)-.1737777468223752*cosh(4.8231*x), (3) = .21022728290544188*sin(4.8231*x)-.2816561313410131*cos(4.8231*x)-1.0039906216693695*sinh(4.8231*x)+cosh(4.8231*x)})

 

 

NULL

 

 

NULL


 

Download oddPlots.mw

it is difficult to provide detailed help. I can only suggest that you read the help for the command

StringTools:-DecodeEntities()

to see if it meets your requirements

maybe something like the attached?

  restart;
  with(plots):
  T:=Array([[1,2],[1.5,1]]):
  display
  ( [ seq
      ( seq
        ( plot3d
          ( T[i,j],
            x=i-1..i,
            y=j-1..j,
            shading=zhue,
            style=surface,
            axes=normal,
            view=[0..2,0..2,0..2]
          ),
          i=1..2
        ),
        j=1..2
      )
    ]
  );

 

 

Download arrplot2.mw

 

 

but maybe  something in the attached worksheet will help.

You can extract the final animation to a GIF by rightclicking it and using Export->GIF

  restart;
  with(plots): with(plottools): with(ColorTools): with(combinat):

#
# Number of terms in the fibonacci sequence. Ajust
# as required
#
  N:=24:
#
# A couple of utilities
#
  g:= k-> round~( convert( op(1, a[k])[-1,..], list)):
  h:= k-> round~( convert( op(1, a[k])[1,..], list)):
#
# Initialise the first arc and rectangle
#
  a[1]:= arc( [0,0], fibonacci(1),0..Pi/2):
  r[1]:= rectangle( g(1), h(1)):

#
# Loop through all subsequent arc sections and
# rectangles
#
  for j from 2 by 1 to N do
      fj:=fibonacci(j):
    #
    # Generate the arc section
    #
      a[j]:= arc
             ( [ g(j-1)[1]+cos((j+1)*Pi/2)*fj,
                 g(j-1)[2]+sin((j+1)*Pi/2)*fj
               ],             
               fj,
               (j-1)*Pi/2..j*Pi/2
             );
    #
    # and the corresponding rectangle
    #
      r[j]:= rectangle
             ( g(j),
               h(j),
               color=Color( [ seq( rand()/10^12, k=1..3 ) ] )
             );
  od:

#
# Animate both the arc and the rectangles of the spiral
#
  display
  ( [ seq
      ( display
        ( [ seq( [a[j],r[j]][], j=1..i) ] ),
        i=1..N
      )
    ],
    scaling=constrained,
    axes=none,
    insequence=true,
    size=[1200,1200]
  );

 

 

Download fibSpiral.mw

 

The attached shows two ways of achieving the same thing whilst alllowing for both numeric and non-numeric arguments

  h:= x->`if`( type(x, numeric),
               piecewise( x<=0,
                          sin(3*x),
                          sin(x/3)
                        ),
              'h(x)'
             ):
  h(1);h(x);
  plot( h(x), x=-10..10);

sin(1/3)

 

h(x)

 

 

  H:= proc(x)
           if   type(x, numeric)
           then  return piecewise( x<=0,
                                   sin(3*x),
                                   sin(x/3)
                                 ):
           else  return 'procname(x)'
           fi;
      end proc:
  H(1); H(x);
  plot( H(x), x=-10..10);

sin(1/3)

 

H(x)

 

 

 

 


 

Download pwise.mw

First 70 71 72 73 74 75 76 Last Page 72 of 207