tomleslie

13876 Reputation

20 Badges

15 years, 175 days

MaplePrimes Activity


These are answers submitted by tomleslie

the best you are probably going to be able to do is to use

solve({eq1, eq3, eq5}, {a, b, c});

which will attempt to solve for the variables {a, b, c} of the equations {eq1, eq3, eq5} in terms of the 'other' unknowns. This may or may not be possible.

fsolve() will be of no use in an underdetermined system, since it only works for cases where a purely numerical solution is possible.

Further assistance/suggestions may be possible for your specific problem. This will almost certainly require you to upload your worksheet using the big green up-arrow in the Mapleprimes toolbar.

with(LinearAlgebra) is used to load the LinearAlgebra() package, in order to access the Determinant() command. However you subsequently issue a 'restart' command, wihc will unload this package, meaning that the Determinant() command is undefined - this helps the solve() command to fail.

If I just swap round these two commands, then your code will execute and produce solutions - although all of those I got were of the form a+I*b, where both 'a' and 'b' are very close to zero - so much so that maybe Determinant(A)=0, only when omega=0.

Anyhow you can investigate this at  your leisure

``

restart*with(LinearAlgebra); delta := 0.407e-9; C := 2023.2; L := 5*delta

0.2035e-8

(1)

eq := (1/12)*delta^2*S^4+S^2+omega^2/C^2

0.1380408333e-19*S^4+S^2+0.2442993814e-6*omega^2

(2)

solve(eq, S)

0.7244233290e-6*(-0.6902041665e32+2760816666.*(-0.8430822546e19*omega^2+0.6250000000e45)^(1/2))^(1/2), -0.7244233290e-6*(-0.6902041665e32+2760816666.*(-0.8430822546e19*omega^2+0.6250000000e45)^(1/2))^(1/2), 0.7244233290e-6*(-0.6902041665e32-2760816666.*(-0.8430822546e19*omega^2+0.6250000000e45)^(1/2))^(1/2), -0.7244233290e-6*(-0.6902041665e32-2760816666.*(-0.8430822546e19*omega^2+0.6250000000e45)^(1/2))^(1/2)

(3)

U := _C1*exp(sqrt(-2*C*(3*C-sqrt(-3*delta^2*omega^2+9*C^2)))*x/(C*delta))+_C2*exp(-sqrt(-2*C*(3*C-sqrt(-3*delta^2*omega^2+9*C^2)))*x/(C*delta))+_C3*exp(sqrt(-2*C*(3*C+sqrt(-3*delta^2*omega^2+9*C^2)))*x/(C*delta))+_C4*exp(-sqrt(-2*C*(3*C+sqrt(-3*delta^2*omega^2+9*C^2)))*x/(C*delta))

U2 := diff(U, x)

1214414.026*_C1*(-24560029.44+4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*exp(1214414.026*(-24560029.44+4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*x)-1214414.026*_C2*(-24560029.44+4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*exp(-1214414.026*(-24560029.44+4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*x)+1214414.026*_C3*(-24560029.44-4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*exp(1214414.026*(-24560029.44-4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*x)-1214414.026*_C4*(-24560029.44-4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*exp(-1214414.026*(-24560029.44-4046.4*(-0.496947e-18*omega^2+36840044.16)^(1/2))^(1/2)*x)

(4)

A := simplify(Matrix(4, 4, [[coeff(subs(x = 0, U), _C1), coeff(subs(x = 0, U), _C2), coeff(subs(x = 0, U), _C3), coeff(subs(x = 0, U), _C4)], [coeff(subs(x = L, U), _C1), coeff(subs(x = L, U), _C2), coeff(subs(x = L, U), _C3), coeff(subs(x = L, U), _C4)], [coeff(subs(x = L, U2), _C1), coeff(subs(x = L, U2), _C2), coeff(subs(x = L, U2), _C3), coeff(subs(x = L, U2), _C4)], [coeff(subs(x = 0, U2), _C1), coeff(subs(x = 0, U2), _C2), coeff(subs(x = 0, U2), _C3), coeff(subs(x = 0, U2), _C4)]]))

Matrix(%id = 18446744074835891374)

(5)

solve(Determinant(A) = 0)

Warning, solutions may have been lost

 

0.1931795546e-18-0.*I, -0.1931795546e-18-0.*I, 0., 0., 0.1174510328e-18-0.*I, -0.1174510328e-18-0.*I, 0.

(6)

``

``

NULL

Download detProb.mw

In a plot command (like many others), the arguments are evaluated before the plot is attempted.

Forget procedures for the moment, thta's just an extral layer of complication: at the top level

x:=10;
plot(sin(x),x=-Pi..Pi);

The arguments will evaluate to sin(10), and 10=-Pi..Pi : sin(10) won't be what you want, but is valid!  However 10=-Pi..Pi is not a valid option fpr the plot command.

You can circumvent this problem, by using unevaluation quotes. For example, in

x:=10;
plot(sin(x),'x=-Pi..Pi');

the arguments will evaluate to sin(10) and x=-Pi..Pi, which is valid, but will plot a constant value, which again is probably not what you want!

Unevaluating both arguments, will provide what you (probably) want, ie

x:=10;
plot('sin(x)','x=-Pi..Pi');

I've just seen vv's answer. It is true in the above that you don't have to unevaluate the complete argument(s) - just so long as you unevaluate x - so rather than 'x=-Pi..Pi',the version 'x'=-Pi..Pi will work equally well. Ditto sin('x') rather than 'sin(x)'

not to post my version of the solution so FWIW.

Same caveat as Rouben: OP is using Maple 13, and I haven't got anything earlier than Maple 18 - si I might have inadvertently introduced some kind of version issue. Unlike Rouben I' didn't update the with(linalg), and associated commands to with(LinearAlgebra), even although the former has been deprectaed since about Maple V

  restart:
  with(linalg): #deprecated even in Maple 13
  with(plots):  

  xo(t):=u*x(t):
  yo(t):=u*y(t):
  xm(t):=(1-u)*x(t):
  ym(t):=(1-u)*y(t):
  W:=Vector([p(t),q(t),r(t)]):
  Ibody:=Matrix( [ [A+M*yo(t)^2,-M*xo(t)*yo(t),0],
                   [-M*xo(t)*yo(t),B+M*xo(t)^2,0],
                   [0,0,C+M*(xo(t)^2+yo(t)^2)]]):
  Kbody:=multiply(Ibody,W):
  Iem:=Matrix( [ [m*ym(t)^2,-m*xm(t)*ym(t),0],
                 [-m*xm(t)*ym(t),m*xm(t)^2,0],
                 [0,0,m*(xm(t)^2+ym(t)^2)]]):
  Kem:=multiply(Iem,W):
  Kbm:=evalm(Kbody+Kem):
  dK1:=Vector([diff(Kbm[1],t),diff(Kbm[2],t),diff(Kbm[3],t)]):
  dK2:=crossprod(W,Kbm):
  dK:=evalm(dK1+dK2):
  dK[1]:
  dK[2]:
  dK[3]:
  x(t):=cxp*p(t)+cxq*q(t)+cxr*r(t)+cx0:
  y(t):=cyp*p(t)+cyq*q(t)+cyr*r(t)+cy0:
  pars:= [ A=8, B=6, C=4, M=60, m=6, u=0.09, P=1, Mz=1,
           cxp=0.00025, cxq=0.0625, cxr=-0.0375, cx0=0,
           cyp=0.075,  cyq=0.00025, cyr=0.0375, cy0=0
          ]:
  Sys:=dK[1]+P*u*y(t)=0,
       dK[2]-P*u*x(t)=0,dK[3]-Mz=0,
       diff(theta(t),t)-p(t)*cos(phi(t))+q(t)*sin(phi(t))=0,
       diff(psi(t),t)-(p(t)*sin(phi(t))+q(t)*cos(phi(t)))/sin(theta(t))=0,
       diff(phi(t),t)-r(t)+cot(theta(t))*(p(t)*sin(phi(t))+q(t)*cos(phi(t)))=0:
  inc:=p(0)=1,q(0)=0,r(0)=0,theta(0)=1,psi(0)=2,phi(0)=1:
  SOL:=dsolve(eval( {Sys,inc},pars), numeric, maxfun=0):

  odeplot(SOL,[t,p(t)],0..100);
  odeplot(SOL,[t,q(t)],0..100);
  odeplot(SOL,[t,r(t)],0..100);
  odeplot(SOL,[p(t),q(t),r(t)],0..3500,numpoints=50000);
  odeplot(SOL,[t,eval(cxp*p(t)+cxq*q(t)+cxr*r(t)+cx0, pars)],0..700);
  odeplot(SOL,[t,eval(cyp*p(t)+cyq*q(t)+cyr*r(t)+cy0, pars)],0..700);
  odeplot(SOL, [t,phi(t)], t=0..100);
  odeplot(SOL, [t,theta(t)], t=0..100);
  odeplot(SOL, [t,psi(t)], t=0..100);

 

 

 

Download fixODE.mws

just because alternatives are good.

Consider using a (simple) module, which offers both encapsulation and the speed you require, because all of the commands which only need to be performed once, will only be performed once, during the module definition.

Contemplate the attached.

  restart;
  with(CodeTools):
#
# Check the length of time to run the ifactor() command
#
  Usage( op([1,1], ifactor(45!+1)));

memory used=139.67MiB, alloc change=72.00MiB, cpu time=1.65s, real time=1.65s, gc time=62.40ms

 

293

(1)

  restart;
  with(CodeTools):
#
# Check the length of time to define a module containing
# the ifactor command, and a 'simple' procedure which uses
# the result of the ifactor() command. This is (almost)
# exactly the same as the above, because the ifactor()
# command is executed and output assigned to 'myfun' during
# the module definition
#
  m3:= Usage( module( )
                     local myfun;
                     export foo;
                     myfun:= op([1,1], ifactor(45!+1)):
                     foo:= proc(n)
                                n*myfun;
                     end proc;
              end module
            );

memory used=139.78MiB, alloc change=72.00MiB, cpu time=1.65s, real time=1.65s, gc time=78.00ms

 

_m619214496

(2)

#
# Verify that subsequent calls to the procedure 'foo' do
# not involve reevaluation of 'myfun' - so this should be
# blindingly fast
#
  Usage(m3:-foo(2), iterations=10000);

memory used=32 bytes, alloc change=0 bytes, cpu time=1.50us, real time=7.0e+02ns, gc time=0ns

 

586

(3)

#
# So for the test case of your integral, you would want
# to define a module something like
#
  restart;
  with(CodeTools):
  m1:= module( )
              local myfun;
              export foo;
              myfun:= unapply( int(x*sin(a*x),x=0..Pi), a)  assuming a::posint;
              foo:= proc(n::posint)
                         myfun(n)
                    end proc;
       end module:
#
# Or even,
#
  m2:= module( )
              local myfun;
              export foo;
              myfun:= int(x*sin(a*x),x=0..Pi) assuming a::posint;
              foo:= proc(n::posint)
                         eval( myfun, a=n);
                    end proc;
      end module:
#
# Rather than
#
  foo:=proc(n::posint)
            local r;
            r:= int(x*sin(n*x),x=0..Pi);
  end proc:
#
# Check the speeds for these three options: using either
# of the 'modules' defined above is waaaay faster cos the
# integral was evaluated (just the once), during the
# module definition.
#
  Usage(m1:-foo(2), iterations=10000);
  Usage(m2:-foo(2), iterations=10000);
  Usage(foo(2), iterations=10000);

memory used=208 bytes, alloc change=0 bytes, cpu time=3.10us, real time=3.00us, gc time=0ns

 

-(1/2)*Pi

 

memory used=312 bytes, alloc change=0 bytes, cpu time=3.10us, real time=3.30us, gc time=0ns

 

-(1/2)*Pi

 

memory used=6.91KiB, alloc change=33.00MiB, cpu time=81.10us, real time=79.90us, gc time=4.68us

 

-(1/2)*Pi

(4)

 


 

Download useModule.mw

 

your procedure for g() uses Limit() rather than limit(). The former is the inert form of the limit command. If you change this to limit() you will get a very different answer!

The Wikipedia article https://en.wikipedia.org/wiki/Lagrange_polynomial is quite informative

I think the basic idea that you could fit (n+1)-points with an n-th order polynomial was known before Lagrange.

Maybe he just got the credit because he showed that the process always worked, by constructing the interpolation polynomial in a specific way?

when you Import() a 'csv' file as a dataframe, then default 'labels' will be added for each row and column - generally these are just 1..m and 1..n. These 'labels' will appear along the top and down the left edge of the displayed data structure (assuming the overall size is small enough to be displayable).

It is important to realise that DataFrames are not matrixes or Arrays, but are in fact implemented as modules, with a bunch of associated 'methods'. Thus the 'labels' are not really zeroth rows/columns in an Array.

If you enter A[2], then you will get all the row labels, as well as the data in the column whose label is 2

 

According to my simple-minded calibrated eyeball,  you need three boundary conditions on u(x,y) + three boundary conditions on theta(x,y) + one boundary condtion on v(x,y): ie a total of seven. You supply four. Hence there is no way that you are going to get a numeric solution (or even an analytic solution without arbitrary constants).

This, for the moment, ignores the fact that not only do you need seven BCs/ICs for a numeric solution, they have to be of the correct type - eg derivative boundary conditions cannot be 'normal' to the boundary

So lets just forget BCs/ICs altogether: The command pdsolve(sys) will return a couple of possible solutions, in terms of (some) arbitrary functions and constants - and these are worth some thought.

  1. In the first solution u(x,y)=0, which isn't very 'interesting'.
  2. In the second solution u(x,y)=C, and on examination of the boundary conditions which you do have, 'C' would have to be zero: so still not very interesting

I can only suggest that you double-check the PDEs which you have supplied. If these are OK,  then come up with seven BCs/ICs whihc do not involve tangential derivatives

I'm not even going to seriously try to "improve" the code you supplied. Just a few comments

  1. Every time you issue the divisors(n) command, then this will be re-evaluated. How many times will your two nested seq() commands re-evaluate divisors(n)??
  2. Why do you do this unnecessary re-evaluation?
  3. One problem with seq() commands is that you can't "break" when a solution meets a particular criterion

You state that your immediate requirement is to "obtain  the least divisor of a number that is greater than it's square root".The attached provides two methods, both of which are reasonably quick. The second, using the select() function is marginally quicker and more memory-efficient.

restart;
getDiv1:=proc( n::posint)
               uses numtheory:
               local sqrtN:= evalf(sqrt(n)),
                     p:= divisors(n),
                     j:
               for j in p do
                   if   j > sqrtN
                   then break:
                   fi
               od;
               return j;
        end proc:
getDiv2:= proc( n::posint)
               uses numtheory:
               local sqrtN:= evalf(sqrt(n)),
                     p:= divisors(n):
               return min(select( i->i>sqrtN, p));
         end proc:
CodeTools:-Usage(getDiv1(20000000));
CodeTools:-Usage(getDiv2(20000000));

memory used=93.20KiB, alloc change=0 bytes, cpu time=0ns, real time=7.00ms, gc time=0ns

 

5000

 

memory used=11.21KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns

 

5000

(1)

 

Download getDiv.mw

if you posted the relevant code using the biog green up-arrow in the MaplePrimes toolbar, but you need to set up a function/procedure which does the following

  1. accepts as input values for the parameters p1, p2, ..p6
  2. generates the vector V1 which is a function of p1, p2, .....p6
  3. subtracts the vector V1 from your 'experimental' vector V2, ie compute V2-V1
  4. square and add all elements of V2-V1, this will be a single number to be returned by the function/procedure.
  5. Use the Optimization:-Minimize() command to find the values of p1,,p6 which minimizes the value returned by (4) above

Doesn't sound too difficult!

When you are fitting a multivariate 'model function' (in your case with the variables 'x' and 't') the points to be fitted have to be supplied in a matrix. If your function has n variables, this matrix will have n+1 columns. The first n columns are values for the variables and the final column is the associated value of the function. So for your case, each row in this matrix has to be in the form

x-value, t-value, p1(x-value, t-value)

I have generated this matrix for the 21 x-values and 11 t-values which you specified: so the resulting matrix is 231x3.

I also had to change the syntax of the NonLinearFit() command to use this matrix

You were inconsistent in your definition of the parameters to be fitted - sometimes these were given as a[1], a[2], b[1], b[2] and sometimes a_1, a_2, b_1, b_2. I have used the latter throughout

I probably fixed a few other syntax errors as and when they occurred. The attached now produces the 'correct' answer

  restart;
  with(Statistics):
#
# Define function
#
  p1 := proc (x, t)
              return (sin(x)+sin(x)*a_1*x*t-sin(x)*t+cos(x)*sin(x)*b_1*t^2*x+(1/2)*sin(x)*t^2-sin(x)*((1/2)*cos(x)*a_1*x*t^2+(1/2)*sin(x)*a_1*t^2-(1/2)*cos(x)*t^2)-cos(x)*((1/2)*sin(x)*b_1*x*t^2-(1/2)*sin(x)*t^2)+cos(x)*((1/2)*sin(x)*a_1*x*t^2-(1/2)*sin(x)*t^2)-sin(x)*((1/2)*cos(x)*b_1*x*t^2+(1/2)*sin(x)*b_1*t^2-(1/2)*cos(x)*t^2)+a_1*x*((1/2)*sin(x)*a_1*x*t^2-(1/2)*sin(x)*t^2)-cos(x)*sin(x)*t^2+sin(x)*a_2*t^2*x^2+((1/2)*sin(x)*a_1*x-(1/2)*sin(x))*a_1*t^2*x-sin(x)*a_1^2*x^2*t^2+(1/2)*sin(x)^2*a_1*t^2+(1/2)*sin(x)^2*b_1*t^2)/(1+a_1*x*t+a_2*x^2*t^2);
        end proc:
#
# Set some values for the 'test' parameters.
# These will become the 'unknowns' which the
# nonLinearFit() command will try to determine
#
# NB p1() does not depend on b_2
#
  a_1 := 1: a_2 := 5: b_1:= 6: b_2 := 3:
#
# Generate a matrix of points which will be used
# for the fit. This matrix is organised with three
# columns
#
# column1 = x_value
# column2 = t_value
# column3 = p1( x_value, t_value)
#
  p1Vals := Matrix([seq( seq( [i, j, evalf(p1(i,j))], i=0..20), j=0..10)]);
#
# Produce a plot of the function with the assumed values
# of the parameters, for comparison with the yet-to-be-
# obtained plot of the function with the fitted parameters
#
  plt1:=plot3d( p1, 0..20, 0..10, color=red);
#
# Reset the parameters to be unknown
#
  a_1 := 'a_1': a_2 := 'a_2': b_1:= 'b_1': b_2 := 'b_2':
#
# Generate the values for these parameters from the
# NonLinearFit() command. Note that b_2 will not be
# obtained because it does not exist in p1()
#
  sol:=NonlinearFit(p1(x,t), p1Vals, [x, t], output = parametervalues);
#
# Note that a_1 and a_2 are very close to the 'assumed'
# values, but b_1 seems to be off by a mile!
#
# Produce a plot of the target function with these fitted parameters
# Looks pretty similar to the original plot - even with a grossly
# different value for b__1
#
  plt2:=plot3d( 'eval'(p1(x,t),sol), x=0..20, t=0..10, color=blue);
#
# Generate a few values of p1(xt) with [a_1=1, a_2=5, b_1=6],
# ie the original assumed values, and then with [a_1=1, a_2=5,
# b_1=-154326.052324557] ie the fitted values: just to see
# if the difference is significant - and it doesn't seem to be.
# I guess the original function just isn't that dependent on
# b_1!
#
  evalf(eval(p1(5,5), [a_1=1.0, a_2=5.0, b_1=6.0])); #assumed
  evalf(eval(p1(5,5), sol)); #fitted

  evalf(eval(p1(10,3), [a_1=1.0, a_2=5.0, b_1=6.0])); #assumed
  evalf(eval(p1(10,3), sol)); #fitted

  evalf(eval(p1(7,2), [a_1=1.0, a_2=5.0, b_1=6.0])); #assumed
  evalf(eval(p1(7,2), sol)); #fitted
#
# The reason why there is little/no dependence on the b_1
# parameter can be seen if one just applies a simplify()
# command to the expression with the procedure p1(). The
# simplified expression does not contain b_1!!!
#
  expr:=(sin(x)+sin(x)*a_1*x*t-sin(x)*t+cos(x)*sin(x)*b_1*t^2*x+(1/2)*sin(x)*t^2-sin(x)*((1/2)*cos(x)*a_1*x*t^2+(1/2)*sin(x)*a_1*t^2-(1/2)*cos(x)*t^2)-cos(x)*((1/2)*sin(x)*b_1*x*t^2-(1/2)*sin(x)*t^2)+cos(x)*((1/2)*sin(x)*a_1*x*t^2-(1/2)*sin(x)*t^2)-sin(x)*((1/2)*cos(x)*b_1*x*t^2+(1/2)*sin(x)*b_1*t^2-(1/2)*cos(x)*t^2)+a_1*x*((1/2)*sin(x)*a_1*x*t^2-(1/2)*sin(x)*t^2)-cos(x)*sin(x)*t^2+sin(x)*a_2*t^2*x^2+((1/2)*sin(x)*a_1*x-(1/2)*sin(x))*a_1*t^2*x-sin(x)*a_1^2*x^2*t^2+(1/2)*sin(x)^2*a_1*t^2+(1/2)*sin(x)^2*b_1*t^2)/(1+a_1*x*t+a_2*x^2*t^2);
  simplify(expr);

p1Vals := Matrix(231, 3, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0., (2, 1) = 1, (2, 2) = 0, (2, 3) = .8414709848, (3, 1) = 2, (3, 2) = 0, (3, 3) = .9092974268, (4, 1) = 3, (4, 2) = 0, (4, 3) = .1411200081, (5, 1) = 4, (5, 2) = 0, (5, 3) = -.7568024953, (6, 1) = 5, (6, 2) = 0, (6, 3) = -.9589242747, (7, 1) = 6, (7, 2) = 0, (7, 3) = -.2794154982, (8, 1) = 7, (8, 2) = 0, (8, 3) = .6569865987, (9, 1) = 8, (9, 2) = 0, (9, 3) = .9893582466, (10, 1) = 9, (10, 2) = 0, (10, 3) = .4121184852, (11, 1) = 10, (11, 2) = 0, (11, 3) = -.5440211109, (12, 1) = 11, (12, 2) = 0, (12, 3) = -.9999902066, (13, 1) = 12, (13, 2) = 0, (13, 3) = -.5365729180, (14, 1) = 13, (14, 2) = 0, (14, 3) = .4201670368, (15, 1) = 14, (15, 2) = 0, (15, 3) = .9906073557, (16, 1) = 15, (16, 2) = 0, (16, 3) = .6502878402, (17, 1) = 16, (17, 2) = 0, (17, 3) = -.2879033167, (18, 1) = 17, (18, 2) = 0, (18, 3) = -.9613974919, (19, 1) = 18, (19, 2) = 0, (19, 3) = -.7509872468, (20, 1) = 19, (20, 2) = 0, (20, 3) = .1498772097, (21, 1) = 20, (21, 2) = 0, (21, 3) = .9129452507, (22, 1) = 0, (22, 2) = 1, (22, 3) = 0., (23, 1) = 1, (23, 2) = 1, (23, 3) = .6611557740, (24, 1) = 2, (24, 2) = 1, (24, 3) = .8104607500, (25, 1) = 3, (25, 2) = 1, (25, 3) = .1310400075, (26, 1) = 4, (26, 2) = 1, (26, 3) = -.7167364808, (27, 1) = 5, (27, 2) = 1, (27, 3) = -.9186640954, (28, 1) = 6, (28, 2) = 1, (28, 3) = -.2697031948, (29, 1) = 7, (29, 2) = 1, (29, 3) = .6375107114, (30, 1) = 8, (30, 2) = 1, (30, 3) = .9637973192, (31, 1) = 9, (31, 2) = 1, (31, 3) = .4026844476, (32, 1) = 10, (32, 2) = 1, (32, 3) = -.5328425950, (33, 1) = 11, (33, 2) = 1, (33, 3) = -.9813518154, (34, 1) = 12, (34, 2) = 1, (34, 3) = -.5274226294, (35, 1) = 13, (35, 2) = 1, (35, 3) = .4135637132, (36, 1) = 14, (36, 2) = 1, (36, 3) = .9761713692, (37, 1) = 15, (37, 2) = 1, (37, 3) = .6414539563, (38, 1) = 16, (38, 2) = 1, (38, 3) = -.2842407071, (39, 1) = 17, (39, 2) = 1, (39, 3) = -.9498975218, (40, 1) = 18, (40, 2) = 1, (40, 3) = -.7425105757, (41, 1) = 19, (41, 2) = 1, (41, 3) = .1482757820, (42, 1) = 20, (42, 2) = 1, (42, 3) = .9036847966, (43, 1) = 0, (43, 2) = 2, (43, 3) = 0., (44, 1) = 1, (44, 2) = 2, (44, 3) = .6951282045, (45, 1) = 2, (45, 2) = 2, (45, 3) = .8237164926, (46, 1) = 3, (46, 2) = 2, (46, 3) = .1320641786, (47, 1) = 4, (47, 2) = 2, (47, 3) = -.7199975108, (48, 1) = 5, (48, 2) = 2, (48, 3) = -.9213929920, (49, 1) = 6, (49, 2) = 2, (49, 3) = -.2702668325, (50, 1) = 7, (50, 2) = 2, (50, 3) = .6384985335, (51, 1) = 8, (51, 2) = 2, (51, 3) = .9649484827, (52, 1) = 9, (52, 2) = 2, (52, 3) = .4030664623, (53, 1) = 10, (53, 2) = 2, (53, 3) = -.5332537460, (54, 1) = 11, (54, 2) = 2, (54, 3) = -.9819797402, (55, 1) = 12, (55, 2) = 2, (55, 3) = -.5277069972, (56, 1) = 13, (56, 2) = 2, (56, 3) = .4137541557, (57, 1) = 14, (57, 2) = 2, (57, 3) = .9765597458, (58, 1) = 15, (58, 2) = 2, (58, 3) = .6416766572, (59, 1) = 16, (59, 2) = 2, (59, 3) = -.2843275720, (60, 1) = 17, (60, 2) = 2, (60, 3) = -.9501550105, (61, 1) = 18, (61, 2) = 2, (61, 3) = -.7426903186, (62, 1) = 19, (62, 2) = 2, (62, 3) = .1483080310, (63, 1) = 20, (63, 2) = 2, (63, 3) = .9038623480, (64, 1) = 0, (64, 2) = 3, (64, 3) = 0., (65, 1) = 1, (65, 2) = 3, (65, 3) = .7126744057, (66, 1) = 2, (66, 2) = 3, (66, 3) = .8290653010, (67, 1) = 3, (67, 2) = 3, (67, 3) = .1324487787, (68, 1) = 4, (68, 2) = 3, (68, 3) = -.7211821866, (69, 1) = 5, (69, 2) = 3, (69, 3) = -.9223658120, (70, 1) = 6, (70, 2) = 3, (70, 3) = -.2704653373, (71, 1) = 7, (71, 2) = 3, (71, 3) = .6388435021, (72, 1) = 8, (72, 2) = 3, (72, 3) = .9653480034, (73, 1) = 9, (73, 2) = 3, (73, 3) = .4031984146, (74, 1) = 10, (74, 2) = 3, (74, 3) = -.5333952296, (75, 1) = 11, (75, 2) = 3, (75, 3) = -.9821951629, (76, 1) = 12, (76, 2) = 3, (76, 3) = -.5278043104, (77, 1) = 13, (77, 2) = 3, (77, 3) = .4138191894, (78, 1) = 14, (78, 2) = 3, (78, 3) = .9766921334, (79, 1) = 15, (79, 2) = 3, (79, 3) = .6417524526, (80, 1) = 16, (80, 2) = 3, (80, 3) = -.2843570964, (81, 1) = 17, (81, 2) = 3, (81, 3) = -.9502424241, (82, 1) = 18, (82, 2) = 3, (82, 3) = -.7427512746, (83, 1) = 19, (83, 2) = 3, (83, 3) = .1483189573, (84, 1) = 20, (84, 2) = 3, (84, 3) = .9039224543, (85, 1) = 0, (85, 2) = 4, (85, 3) = 0., (86, 1) = 1, (86, 2) = 4, (86, 3) = .7226750809, (87, 1) = 2, (87, 2) = 4, (87, 3) = .8319104117, (88, 1) = 3, (88, 2) = 4, (88, 3) = .1326489571, (89, 1) = 4, (89, 2) = 4, (89, 3) = -.7217923567, (90, 1) = 5, (90, 2) = 4, (90, 3) = -.9228637873, (91, 1) = 6, (91, 2) = 4, (91, 3) = -.2705665392, (92, 1) = 7, (92, 2) = 4, (92, 3) = .6390188720, (93, 1) = 8, (93, 2) = 4, (93, 3) = .9655506739, (94, 1) = 9, (94, 2) = 4, (94, 3) = .4032652417, (95, 1) = 10, (95, 2) = 4, (95, 3) = -.5334667902, (96, 1) = 11, (96, 2) = 4, (96, 3) = -.9823040045, (97, 1) = 12, (97, 2) = 4, (97, 3) = -.5278534343, (98, 1) = 13, (98, 2) = 4, (98, 3) = .4138519940, (99, 1) = 14, (99, 2) = 4, (99, 3) = .9767588700, (100, 1) = 15, (100, 2) = 4, (100, 3) = .6417906401, (101, 1) = 16, (101, 2) = 4, (101, 3) = -.2843719643, (102, 1) = 17, (102, 2) = 4, (102, 3) = -.9502864252, (103, 1) = 18, (103, 2) = 4, (103, 3) = -.7427819461, (104, 1) = 19, (104, 2) = 4, (104, 3) = .1483244535, (105, 1) = 20, (105, 2) = 4, (105, 3) = .9039526788, (106, 1) = 0, (106, 2) = 5, (106, 3) = 0., (107, 1) = 1, (107, 2) = 5, (107, 3) = .7290607391, (108, 1) = 2, (108, 2) = 5, (108, 3) = .8336709284, (109, 1) = 3, (109, 2) = 5, (109, 3) = .1327715413, (110, 1) = 4, (110, 2) = 5, (110, 3) = -.7221640832, (111, 1) = 5, (111, 2) = 5, (111, 3) = -.9231662289, (112, 1) = 6, (112, 2) = 5, (112, 3) = -.2706278778, (113, 1) = 7, (113, 2) = 5, (113, 3) = .6391250088, (114, 1) = 8, (114, 2) = 5, (114, 3) = .9656731996, (115, 1) = 9, (115, 2) = 5, (115, 3) = .4033056083, (116, 1) = 10, (116, 2) = 5, (116, 3) = -.5335099868, (117, 1) = 11, (117, 2) = 5, (117, 3) = -.9823696691, (118, 1) = 12, (118, 2) = 5, (118, 3) = -.5278830570, (119, 1) = 13, (119, 2) = 5, (119, 3) = .4138717683, (120, 1) = 14, (120, 2) = 5, (120, 3) = .9767990849, (121, 1) = 15, (121, 2) = 5, (121, 3) = .6418136450, (122, 1) = 16, (122, 2) = 5, (122, 3) = -.2843809186, (123, 1) = 17, (123, 2) = 5, (123, 3) = -.9503129194, (124, 1) = 18, (124, 2) = 5, (124, 3) = -.7428004108, (125, 1) = 19, (125, 2) = 5, (125, 3) = .1483277615, (126, 1) = 20, (126, 2) = 5, (126, 3) = .9039708682, (127, 1) = 0, (127, 2) = 6, (127, 3) = 0., (128, 1) = 1, (128, 2) = 6, (128, 3) = .7334747084, (129, 1) = 2, (129, 2) = 6, (129, 3) = .8348665324, (130, 1) = 3, (130, 2) = 6, (130, 3) = .1328542846, (131, 1) = 4, (131, 2) = 6, (131, 3) = -.7224142234, (132, 1) = 5, (132, 2) = 6, (132, 3) = -.9233693691, (133, 1) = 6, (133, 2) = 6, (133, 3) = -.2706690256, (134, 1) = 7, (134, 2) = 6, (134, 3) = .6391961459, (135, 1) = 8, (135, 2) = 6, (135, 3) = .9657552667, (136, 1) = 9, (136, 2) = 6, (136, 3) = .4033326316, (137, 1) = 10, (137, 2) = 6, (137, 3) = -.5335388925, (138, 1) = 11, (138, 2) = 6, (138, 3) = -.9824135947, (139, 1) = 12, (139, 2) = 6, (139, 3) = -.5279028674, (140, 1) = 13, (140, 2) = 6, (140, 3) = .4138849892, (141, 1) = 14, (141, 2) = 6, (141, 3) = .9768259669, (142, 1) = 15, (142, 2) = 6, (142, 3) = .6418290197, (143, 1) = 16, (143, 2) = 6, (143, 3) = -.2843869021, (144, 1) = 17, (144, 2) = 6, (144, 3) = -.9503306215, (145, 1) = 18, (145, 2) = 6, (145, 3) = -.7428127462, (146, 1) = 19, (146, 2) = 6, (146, 3) = .1483299714, (147, 1) = 20, (147, 2) = 6, (147, 3) = .9039830173, (148, 1) = 0, (148, 2) = 7, (148, 3) = 0., (149, 1) = 1, (149, 2) = 7, (149, 3) = .7367028582, (150, 1) = 2, (150, 2) = 7, (150, 3) = .8357311526, (151, 1) = 3, (151, 2) = 7, (151, 3) = .1329138828, (152, 1) = 4, (152, 2) = 7, (152, 3) = -.7225940261, (153, 1) = 5, (153, 2) = 7, (153, 3) = -.9235152060, (154, 1) = 6, (154, 2) = 7, (154, 3) = -.2706985418, (155, 1) = 7, (155, 2) = 7, (155, 3) = .6392471430, (156, 1) = 8, (156, 2) = 7, (156, 3) = .9658140727, (157, 1) = 9, (157, 2) = 7, (157, 3) = .4033519887, (158, 1) = 10, (158, 2) = 7, (158, 3) = -.5335595921, (159, 1) = 11, (159, 2) = 7, (159, 3) = -.9824450431, (160, 1) = 12, (160, 2) = 7, (160, 3) = -.5279170478, (161, 1) = 13, (161, 2) = 7, (161, 3) = .4138944513, (162, 1) = 14, (162, 2) = 7, (162, 3) = .9768452031, (163, 1) = 15, (163, 2) = 7, (163, 3) = .6418400205, (164, 1) = 16, (164, 2) = 7, (164, 3) = -.2843911832, (165, 1) = 17, (165, 2) = 7, (165, 3) = -.9503432846, (166, 1) = 18, (166, 2) = 7, (166, 3) = -.7428215699, (167, 1) = 19, (167, 2) = 7, (167, 3) = .1483315518, (168, 1) = 20, (168, 2) = 7, (168, 3) = .9039917063, (169, 1) = 0, (169, 2) = 8, (169, 3) = 0., (170, 1) = 1, (170, 2) = 8, (170, 3) = .7391644826, (171, 1) = 2, (171, 2) = 8, (171, 3) = .8363853741, (172, 1) = 3, (172, 2) = 8, (172, 3) = .1329588510, (173, 1) = 4, (173, 2) = 8, (173, 3) = -.7227294934, (174, 1) = 5, (174, 2) = 8, (174, 3) = -.9236249854, (175, 1) = 6, (175, 2) = 8, (175, 3) = -.2707207468, (176, 1) = 7, (176, 2) = 8, (176, 3) = .6392854919, (177, 1) = 8, (177, 2) = 8, (177, 3) = .9658582795, (178, 1) = 9, (178, 2) = 8, (178, 3) = .4033665365, (179, 1) = 10, (179, 2) = 8, (179, 3) = -.5335751458, (180, 1) = 11, (180, 2) = 8, (180, 3) = -.9824686693, (181, 1) = 12, (181, 2) = 8, (181, 3) = -.5279276995, (182, 1) = 13, (182, 2) = 8, (182, 3) = .4139015580, (183, 1) = 14, (183, 2) = 8, (183, 3) = .9768596497, (184, 1) = 15, (184, 2) = 8, (184, 3) = .6418482813, (185, 1) = 16, (185, 2) = 8, (185, 3) = -.2843943974, (186, 1) = 17, (186, 2) = 8, (186, 3) = -.9503527925, (187, 1) = 18, (187, 2) = 8, (187, 3) = -.7428281944, (188, 1) = 19, (188, 2) = 8, (188, 3) = .1483327383, (189, 1) = 20, (189, 2) = 8, (189, 3) = .9039982291, (190, 1) = 0, (190, 2) = 9, (190, 3) = 0., (191, 1) = 1, (191, 2) = 9, (191, 3) = .7411027588, (192, 1) = 2, (192, 2) = 9, (192, 3) = .8368976012, (193, 1) = 3, (193, 2) = 9, (193, 3) = .1329939853, (194, 1) = 4, (194, 2) = 9, (194, 3) = -.7228352205, (195, 1) = 5, (195, 2) = 9, (195, 3) = -.9237106069, (196, 1) = 6, (196, 2) = 9, (196, 3) = -.2707380576, (197, 1) = 7, (197, 2) = 9, (197, 3) = .6393153784, (198, 1) = 8, (198, 2) = 9, (198, 3) = .9658927228, (199, 1) = 9, (199, 2) = 9, (199, 3) = .4033778689, (200, 1) = 10, (200, 2) = 9, (200, 3) = -.5335872601, (201, 1) = 11, (201, 2) = 9, (201, 3) = -.9824870687, (202, 1) = 12, (202, 2) = 9, (202, 3) = -.5279359940, (203, 1) = 13, (203, 2) = 9, (203, 3) = .4139070915, (204, 1) = 14, (204, 2) = 9, (204, 3) = .9768708971, (205, 1) = 15, (205, 2) = 9, (205, 3) = .6418547125, (206, 1) = 16, (206, 2) = 9, (206, 3) = -.2843968998, (207, 1) = 17, (207, 2) = 9, (207, 3) = -.9503601936, (208, 1) = 18, (208, 2) = 9, (208, 3) = -.7428333509, (209, 1) = 19, (209, 2) = 9, (209, 3) = .1483336619, (210, 1) = 20, (210, 2) = 9, (210, 3) = .9040033060, (211, 1) = 0, (211, 2) = 10, (211, 3) = 0., (212, 1) = 1, (212, 2) = 10, (212, 3) = .7426681298, (213, 1) = 2, (213, 2) = 10, (213, 3) = .8373095059, (214, 1) = 3, (214, 2) = 10, (214, 3) = .1330221926, (215, 1) = 4, (215, 2) = 10, (215, 3) = -.7229200306, (216, 1) = 5, (216, 2) = 10, (216, 3) = -.9237792531, (217, 1) = 6, (217, 2) = 10, (217, 3) = -.2707519314, (218, 1) = 7, (218, 2) = 10, (218, 3) = .6393393253, (219, 1) = 8, (219, 2) = 10, (219, 3) = .9659203155, (220, 1) = 9, (220, 2) = 10, (220, 3) = .4033869463, (221, 1) = 10, (221, 2) = 10, (221, 3) = -.5335969622, (222, 1) = 11, (222, 2) = 10, (222, 3) = -.9825018032, (223, 1) = 12, (223, 2) = 10, (223, 3) = -.5279426358, (224, 1) = 13, (224, 2) = 10, (224, 3) = .4139115221, (225, 1) = 14, (225, 2) = 10, (225, 3) = .9768799024, (226, 1) = 15, (226, 2) = 10, (226, 3) = .6418598613, (227, 1) = 16, (227, 2) = 10, (227, 3) = -.2843989030, (228, 1) = 17, (228, 2) = 10, (228, 3) = -.9503661184, (229, 1) = 18, (229, 2) = 10, (229, 3) = -.7428374785, (230, 1) = 19, (230, 2) = 10, (230, 3) = .1483344012, (231, 1) = 20, (231, 2) = 10, (231, 3) = .9040073698})

 

 

[a_1 = HFloat(0.9999999993312713), a_2 = HFloat(4.999999997371034), b_1 = HFloat(-154326.05232455724)]

 

 

-.9231662289

 

HFloat(-0.9231661940849563)

 

-.5333952295

 

HFloat(-0.5333952509804192)

 

.6384985338

 

HFloat(0.6384985352051729)

 

(sin(x)+sin(x)*a_1*x*t-sin(x)*t+cos(x)*sin(x)*b_1*t^2*x+(1/2)*sin(x)*t^2-sin(x)*((1/2)*cos(x)*a_1*x*t^2+(1/2)*sin(x)*a_1*t^2-(1/2)*cos(x)*t^2)-cos(x)*((1/2)*sin(x)*b_1*x*t^2-(1/2)*sin(x)*t^2)+cos(x)*((1/2)*sin(x)*a_1*x*t^2-(1/2)*sin(x)*t^2)-sin(x)*((1/2)*cos(x)*b_1*x*t^2+(1/2)*sin(x)*b_1*t^2-(1/2)*cos(x)*t^2)+a_1*x*((1/2)*sin(x)*a_1*x*t^2-(1/2)*sin(x)*t^2)-cos(x)*sin(x)*t^2+sin(x)*a_2*t^2*x^2+((1/2)*sin(x)*a_1*x-(1/2)*sin(x))*a_1*t^2*x-sin(x)*a_1^2*x^2*t^2+(1/2)*sin(x)^2*a_1*t^2+(1/2)*sin(x)^2*b_1*t^2)/(a_2*t^2*x^2+a_1*t*x+1)

 

(2+(2*a_2*x^2-2*a_1*x+1)*t^2+(2*a_1*x-2)*t)*sin(x)/(2*a_2*t^2*x^2+2*a_1*t*x+2)

(1)

 

Download fitProb.mw

Nobody can do anything with a picture.

Do you mean something like

restart;
M1:=Matrix(6,6,(i,j)->cos((i-1)*(j-1)*2*Pi/6)-I*sin((i-1)*(j-1)*2*Pi/6));
M2:=Matrix(6,6,(i,j)->cos((i-1)*(j-1)*2*Pi/6)+I*sin((i-1)*(j-1)*2*Pi/6));
evalc~(M1.M2);

 

 

Compare the output of the final two commands in order to see the 'scanning' order for the array as used by Maple's convert/list command

restart;
a:=plot3d(theta*z,theta=0..2,z=0..1,coords=cylindrical,grid=[3,2]):
A:=op([1,1],a):
CC:=convert(A,list,nested);
DD:= [ [ A[1, 1, 1..3], A[1, 2, 1..3] ],
       [ A[2, 1, 1..3], A[2, 2, 1..3] ],
       [ A[3, 1, 1..3], A[3, 2, 1..3] ]
     ];

CC := [[[0., 0., 0.], [0., 0., 1.]], [[0., 0., 0.], [.540302305868140, .841470984807897, 1.]], [[-0., 0., 0.], [-.832293673094285, 1.81859485365136, 1.]]]

 

[[Array(%id = 18446744074384401822), Array(%id = 18446744074384401942)], [Array(%id = 18446744074384402062), Array(%id = 18446744074384402182)], [Array(%id = 18446744074384402302), Array(%id = 18446744074384402422)]]

(1)

 


 

Download arrScan.mw

Your first example fails because

  1. the second argument is a list, not a vector
  2. even if the second argument were a vector, it would fail because the arguments are in the wrong order

Your second example fails because there is no command 'multtiply' - but there is a command 'Multiply' - note capitalisation.

The following 'toy' examples all work correctly

with(LinearAlgebra):
M := RandomMatrix(4,4);
c:=Vector[row](4,[0,0,0,1]);
d:=Vector[column](4,[0,0,0,1]);


VectorMatrixMultiply(c, M^(-1));
MatrixVectorMultiply(M^(-1), d);
Multiply(c, M^(-1));
Multiply( M^(-1), d);

 

First 134 135 136 137 138 139 140 Last Page 136 of 207