tomleslie

8833 Reputation

17 Badges

11 years, 165 days

MaplePrimes Activity


These are answers submitted by tomleslie

With the definitions you have provided, it seems that x(t) is entirely arbitrary (although I think it has to be differentiable).

This doesn't seem to get you very far|??.

But in any case check out the attached, and try to work out what I might be doing wrong, or (more likely), where you have incorrectly specified the problem

odeSys.mw

Is it possible to export a big symbolic matrices or lists, from Maple mileu to Matlab in new versions of Maple?

Probably(?) not: because matlab handles symbolic matrices very badly. Actually Matlab handles symbolic "anything" very badly if at all.

For example, the matlab command to construct a simple matrix, ie

 a=[1 2;3 4]

will immediately throw an error when provided with a 'symbolic' matrix, such as

a=[sin(x) cos(x);cos(x) sin(x)]

Now depending on which matlab toolboxes you have loaded, I suppose this might be possible. A long time ago the Matlab symbolic toolbox was essentially a (very) stripped-down version of Maple, but is now (I believe) a completely different CAS based on something called MuPad. So I'm guessing that that you would have to check MuPad's import capabilities - bearing in mind that the version of MuPad implemented within Matalb is also seriously crippled - as in, from the Matlab help

MuPAD Files and Interfaces
Open MuPAD® notebooks, program files, and graphics from MATLAB®

Note:   MuPAD notebooks are not recommended. Use MATLAB live scripts instead.

So Matlab cannot handle Maple symbolics, and only handles a restricted range of MuPad symbolics - because Matlab really is not designed for symbolic manipulations (Great afornumerics though - provided you only ever need hardware precision!)

 

  If no, why Maple dont have such ability?

The primary reason is because Maple 'assumes' that you only have a bare Matlab installation. After all, how would Maple know which of the 100 or so additional Matlab toolboxes any particular user *might* have installed. And since a bare matlab installation has no symbolic capabilty at all - what would/could Maple export

Secondly Maple will (perfectly happily) output 'numeric' matrices in matlab format (see the Maple help at ?ExportMatrix). But for 'symbolics', what you actually need is MuPad format - and I'm not convinced that the version of MuPad which is integrated with Matlab, has any kind of "import" capability at all. Regrettably since I don't have the 'symbolic' toolbox in my Matlab installation, I can't really test this

 

perhaps depending on how old your Maple installation is.the linalg[diag] command has been deprecated since Maple6. A 'diag' command still exists within the current MTM package (and works). ALthough as Kitonum has already siad the recommended way would be to use the LinearAlgebra:-Diagonal command.

The attached shows all three options, for a "toy" symbolicc matrix


 

  restart;
#
# If you want to use only stuff from the *deprecated*
# linalg package - which superseded in Maple 6 - so
# you have to have a seriosly ancient Maple installation
# to want to do this!!
#
  with(linalg):
#
# Define some more or less arbitrary symbolic
# matrix
#
  M:=  matrix(4,4,(i,j) -> (x^i)*cos(j*t));
#
# extract the diagonal elements of this
# matrix, setting other entries to zero
#
  MM:= matrix(4,4,(i,j) -> `if`(i=j, M[i,j], 0));
#
# Extract the diagonal entries of the original
# matrix, expressing these as a column vector
#
  MMM:= matrix(4,1, i -> M[i,i]);
#
# Now you can get close using the 'diag' command from
# linalg package - provided you know how to use it
# But why would you want to??
#
  MMMM:=diag(seq(M[j,j], j=1..4));

M := Matrix(4, 4, {(1, 1) = x*cos(t), (1, 2) = x*cos(2*t), (1, 3) = x*cos(3*t), (1, 4) = x*cos(4*t), (2, 1) = x^2*cos(t), (2, 2) = x^2*cos(2*t), (2, 3) = x^2*cos(3*t), (2, 4) = x^2*cos(4*t), (3, 1) = x^3*cos(t), (3, 2) = x^3*cos(2*t), (3, 3) = x^3*cos(3*t), (3, 4) = x^3*cos(4*t), (4, 1) = x^4*cos(t), (4, 2) = x^4*cos(2*t), (4, 3) = x^4*cos(3*t), (4, 4) = x^4*cos(4*t)})

 

MM := Matrix(4, 4, {(1, 1) = x*cos(t), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = x^2*cos(2*t), (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = x^3*cos(3*t), (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = x^4*cos(4*t)})

 

MMM := Matrix(4, 1, {(1, 1) = x*cos(t), (2, 1) = x^2*cos(2*t), (3, 1) = x^3*cos(3*t), (4, 1) = x^4*cos(4*t)})

 

array( 1 .. 4, 1 .. 4, [( 1, 1 ) = (x*cos(t)), ( 3, 3 ) = (x^3*cos(3*t)), ( 2, 2 ) = (x^2*cos(2*t)), ( 4, 4 ) = (x^4*cos(4*t))  ] )

(1)

#
# The next place a 'diag' command exists is the
# MTM package, which you might want to use like
# this
#
  restart;
  with(MTM):
#
# Define some more or less arbitrary symbolic
# matrix
#
  M:=  Matrix(4,4,(i,j) -> (x^i)*cos(j*t));
#
# Get its diagonal
#
  diag(M);

_rtable[18446744074333061118]

 

Vector[column](%id = 18446744074372865670)

(2)

#
# Now the easy way - just use the LinearAlgebra
# package with the Diagonal() command
#
  restart;
  with(LinearAlgebra):
#
# Define some more or less arbitrary symbolic
# matrix
#
  M:=  Matrix(4,4,(i,j) -> (x^i)*cos(j*t));
#
# Get its diagonal
#
  MM:= Diagonal(M);
  
 

_rtable[18446744074333061118]

 

Vector[column](%id = 18446744074373176486)

(3)

 


 

Download matDiag.mw

on the size of the monitor and the display rersolution. My default for running Maple(and everything else)  is a 27-inch monitor with a native resolution of 2560 by 1440 and in terms of readability, this is acceptable (and my eyes are old!!!). The only thing I change for Maple is on the interface settings where I check the box at Tools->Interface->Large Toolbar Icons.

Now I still had some font size issues with these settings. My pet hate was that text in the Maple debugger was too small and could not be resized by any known means. This particular issue was fixed in either Maple 2017.1 or Maple 2017.2 (can't remember which, but probably the latter). I didn't observe any other font size problems being fixed at the same time (but they might have been).

The basic problem for software user interfaces (including Maple) is that many fonts/menuStuff etc was defined to be a fixed number of pixels. So as the display resolution goes up, the apparent  'size'' of these fonts goes down. This problem is made worse increased use of laptops with smaller screens. A pixel, on a 15-inch laptop screen with 2560x1440 resolution is a lot smaller than a pixel on 27-inch monitor running at the same resolution - so any text (in menus, whatever) will be correspondingly smaller

The obvious solution for this problem is that 'important text' (menus whatever) should be defined in terms of 'fractionOfScreenSize' rather than absolute pixels. However, historically, most user interfaces were not written that way - absolute pixels were used. So many software packages which did not anticipate the arrival of small (ie laptop), high-resolution monitors, now have visibility problems. This is not just a Maple issue - it applies to several other packages I use (eg Matlab)

Until softwre providers get ther act together and write user interfaces in terms of percentageOfScreenSize rather than absolute pixels, there is no good answer to the readability problem. The best I can suggest is to decrease the display resolution. On a Windows OS, this can be achieved by a right-click on the desktop, select 'screen resolution', then decrease it. Each decrease in screen resolution will cuase a corresponding increase in displayed font sizes. One possible drawback with this approach is that resulting fonts may look a litlle 'blurry' :-(

is performed by reflection through a plane which contains these axes.

Your problem statement is confusing by the fact that (in general) most people thinkk of cartesian axes as x, y, x in a 'sequence'. You however have labelled these axes as Z, Y, X - so pretty much reverse order. So when you say you want " the X and Y-axes reversed ", I'm not completely clear whether you want the first and second axes reversed (ie x and y) or the second and third axes reversed (ie the ones you have labelled X and Y)

However the principle remains the same: the attache shows your original plot, then shows it reflected through all axes planes - ie firstAxis/secondAxis, firtAxis/thirdAxis, secondAxis/thirdAxis. One of them has to be correct. You just have to pick which one

I tried uploading the following with all its graphical output, but (for reasons unknown) this continually failed. Hence the following is 'input code' only


 

  restart;

  p1:=plots:-shadebetween( 0, 2-x-y,
                           x = 0 .. 1, y = x^2 .. sqrt(x),
                           scaling = unconstrained,
                           color = yellow,
                           axes = normal,
                           labels = [Z, Y, X],
                           transparency = .9
                         );
#
# reflect through the plane defined by
# firstAxis-secondAxis
#
  plottools:-reflect( p1,
                      [ [0,0,0], [1,0,0], [0,1,0] ]
                     );
#
# reflect through the plane defined by
# firstAxis-thirdAxis
#
  plottools:-reflect( p1,
                      [ [0,0,0], [1,0,0], [0,0,1] ]
                     );
#
# reflect through the plane defined by
# secondAxis-thirAxis
#
  plottools:-reflect( p1,
                      [ [0,0,0], [0,1,0], [0,0,1] ]
                     );

 


 

Download reverseAxes.mw

 

  1. solve() in the attached was taking too long to run so I eventually gave up on it. If yu are more patient than me, then it may be worth 'uncommenting' to see if anything meaningful happens
  2. the basic fsolve(), with range contstraints,  produces one solution, with very respectable residual errors, and is very quick
  3. the SolveEquations() command from the DIrectSearch package, with the option AllSolutions=true produces six solutions, in pretty acceptable time. The first four of these have very respectable residuals - and I'd take all of them as 'solutions'. Both of the solutions generated in Kitonum's earlier answer are in this set of four. The residuals on the final two solutions are rather high - so I'd treat these with care. However, the residuals in these final two solutions probably ought to be compared with the magintudes of some of the terms in your original equations (as in O(10^13), so a residual of ~8, isn't too shabby. I wouldn't discount these final two solutions without some further investigation.

The DirectSearch package is not a part of Maple but is an add-on available from the Maple Applications Center. Please note that until/unless you have the DirectSearch package loaded, the final execution group in the attached worksheet will not execute:-(
 

  restart;

#
# Define equations
#
  focdeltapioptS2Tbeta_eg := 2.*delta*(-8.016120437*10^13*beta-5.599041156*10^11*beta^4-9.950892840*10^12*beta^3+4.172202042*10^9*beta^2*delta^6-3.593992717*10^11*beta^5*delta^2-5.153172141*10^12*beta^4*delta^2+1.100201852*10^9*beta^4*delta^8+3.667339507*10^8*beta^6*delta^8-3.667339507*10^8*beta^3*delta^8-1.100201852*10^9*beta^5*delta^8+2.670209307*10^9*beta^4*delta^4+1.032944471*10^10*beta^3*delta^4+2.114848520*10^13*beta^2*delta^2-1.562440115*10^13*beta^3*delta^2-6.630411895*10^9*beta^3*delta^6-1.582188745*10^10*beta*delta^4+1.713992189*10^9*beta^5*delta^6+7.442176619*10^8*beta^4*delta^6+2.822233434*10^9*beta^2*delta^4+2.464874192*10^10*beta*delta^2+2.000000000*10^10*delta^2-5.383607038*10^13*beta^2)/(-2636.981242*beta^2*delta^2+2636.981242*beta*delta^2-4108.123654*beta-10000.)^3:

  focbetapioptS2Tbeta_eg := (.8333333333*(1.784795533*10^13*beta^4*delta^6-1.780394727*10^13*beta^5*delta^6-5.910514827*10^13*beta^2*delta^4-5.501009263*10^10*beta^8*delta^6+1.701903476*10^14*beta*delta^2+1.100201852*10^10*beta^9*delta^6+1.100201852*10^11*beta^7*delta^6+5.842965601*10^12*beta^6*delta^6-3.878841795*10^13*beta+2.205824535*10^11*beta^5+1.735006720*10^11*beta^4+4.159889289*10^10*beta^6+7.379516540*10^12*beta^3-6.234247772*10^11*beta^6*delta^4+5.141976568*10^10*beta^8*delta^4-1.126878340*10^12*beta^5*delta^2-3.757524927*10^13*beta^4*delta^4+1.556869544*10^13*beta^5*delta^4-8.051300147*10^10*beta^7*delta^4+1.496707827*10^11*beta^6*delta^2+8.010627926*10^10*beta^7*delta^2+1.459035087*10^13-9.619344526*10^13*delta^2+2.590921095*10^11*beta^2-5.952985789*10^12*beta^3*delta^6+2.536603101*10^13*beta*delta^4+1.142130779*10^13*beta^4*delta^2-3.282217618*10^13*beta^2*delta^2-5.169893249*10^13*beta^3*delta^2+5.639818880*10^13*beta^3*delta^4))/((-1.+beta)^2*(-2636.981242*beta^2*delta^2+2636.981242*beta*delta^2-4108.123654*beta-10000.)^3):

#
# Generate and time solution using solve(),
# with constraints
#
# This seemed to take for ever and get nowhere
# so is now commented out
#
#  sol1:= CodeTools:-Usage
#         ( solve
#           ( { focbetapioptS2Tbeta_eg=0,
#               focdeltapioptS2Tbeta_eg=0,
#               beta>0,
#               delta<1
#             }
#            )
#         );

#
# Generate and time solution using fsolve(),
# with constraints
#
  sol2:= CodeTools:-Usage
         ( fsolve
           ( { focbetapioptS2Tbeta_eg=0,
               focdeltapioptS2Tbeta_eg=0
             },
             { beta=0..infinity,
               delta=-infinity..1
             }
           )
         );
#
# Check residuals on fsolve() solution, just
# becuase fsolve() does not supply these by
# default. Useful for comparison with residuals
# generated later by the DirectSearch command
#
  subs[eval]( sol2,
              { focbetapioptS2Tbeta_eg=0,
                focdeltapioptS2Tbeta_eg=0
              }
            );

memory used=5.72MiB, alloc change=32.00MiB, cpu time=47.00ms, real time=47.00ms, gc time=0ns

 

{beta = .3884692297, delta = 0.}

 

{-0.7795891474e-9 = 0, 0. = 0}

(1)

#
# Generate and time solution using
# DirectSearch:-SolveEquations(),w with the
# AllSolutions option set to true, and usign
# supplied constraints
#
  sol3:= CodeTools:-Usage
         ( DirectSearch:-SolveEquations
           ( [ focbetapioptS2Tbeta_eg=0,
               focdeltapioptS2Tbeta_eg=0
             ],
             [ beta>0,
               delta<1
             ],
             AllSolutions=true
           )
          );

memory used=0.61GiB, alloc change=40.00MiB, cpu time=6.91s, real time=6.92s, gc time=452.40ms

 

_rtable[18446744074262522446]

(2)

 

 


 

Download numSols.mw

 

Consider the following

#
# When Maple 'parses' an expression, it does so
# in a two-step process, known as simplification
# and evaluation. So
#
  x+2*x;
#
# will always return 3*x, because this is the
# 'simplification' process. Using uneval quotes
# which only affects the 'evaluation' stage will
# not help. Hence
#
  'x+2*x';
#
# will also return 3*x. Now you can control the
# evaluation process, so
#
  y:=2*x:
  x+y;
#
# will return 3*x, but
#
  y:=2*x:
  'x+y';
#
# will not - because y is not evaluated in the
# expression 'x+y'
#
# In your case of latex(someExpression), your
# problem is that Maple will simplify and
# evaluate the argument 'someExpression', before
# passing it to the latex() command. You can
# prevent the evaluation stage by using uneval
# quotes, but you cannot prevent the simplification
# stage, so
#
  latex(x+2*x);
#
# will give the same answer as
#
  latex('x+2*x');
#
# The following will give the same answer, since
# the evaluation stage is not prevented
#
  y:=2*x;
  latex(x+y);
#
# However the evaluation stage could be prevented with
#
  y:=2*x;
  latex('x+y');
#
# The fundamental problem which you have is that
# for the expression you are supplying, Maple will
# perform its basic simplification operation, which
# you cannot prevent. So
#
  latex( 5*x^3+7*x^2+2*x^3);
#
# and
#
  latex( '5*x^3+7*x^2+2*x^3');
#
# will produce identical results. The only way I can
# think to get around this is to perform the latex
# export as a string - and then sutably 'parse' the
# resulting string in the target application, as in
#
  latex(" 5*x^3+7*x^2+2*x^3")

 

Check the attached


 

restart; eqsA := [R__Arc = (8750+C)/I__Arc^1.4, I__Arc = V__system/sqrt(2*Z1+R__Arc)]; solA := solve(eqsA); eqsB := eval(eqsA, [C = 300, Z1 = 4, V__system = 100]); solB := solve(eqsB); eval(eqsB, solB); fsolve(eqsB); DirectSearch:-SolveEquations(eqsB, evaluationlimit = 100000)

eqsA := [R__Arc = (8750+C)/I__Arc^1.4, I__Arc = V__system/sqrt(2*Z1+R__Arc)]

 

solA := {C = R__Arc*I__Arc^(7/5)-8750., I__Arc = I__Arc, R__Arc = R__Arc, Z1 = Z1, V__system = I__Arc*sqrt(2.*Z1+R__Arc)}

 

eqsB := [R__Arc = 9050/I__Arc^1.4, I__Arc = 100/sqrt(8+R__Arc)]

 

solB := {I__Arc = 1.178819336, R__Arc = 7188.237669}

 

[7188.237669 = 7188.237668, 1.178819336 = 1.178819336]

 

fsolve([R__Arc = 9050/I__Arc^1.4, I__Arc = 100/sqrt(8+R__Arc)], {I__Arc, R__Arc})

 

Warning, complex or non-numeric value encountered; trying to find a feasible point

 

[HFloat(64.64249788652408), Vector[column](%id = 18446744074424695974), [I__Arc = HFloat(6645.4545641310115), R__Arc = HFloat(-7.999773561314546)], 58902]

(1)

 

``


 

Download solveEQ.mw

Having defined a 3-D surface plot (or a 2-D curve), you can use the plottools:-project() command to 'project' the plot on to any specified plane (or a 2d plot on to any line).

You can then use plots:-display() to combine the original plot and its projections in a single figure. See the "toy" examples in the code below

  restart;
  with(plots):
  with(plottools):
  p1:= plot3d( [ x+y+4, 25-x^2-y^2],
                x=-2..2, y=x^2..2-x^2
             ):
  pa:= shadebetween( x+y+4, 25-x^2-y^2,x=0..1,
                     y=x^2..2-x^2,
                     showboundary = false,
                     changefill = [color = khaki, transparency = 0],
                     axes=normal,
                     lightmodel=light1
                   );
#
# Use plottools:-project(), to project on to any desired
# plane
#
  p2:= project(p1, [[0,0,0], [1,0,0], [0,1,0]]); #xy-plane
  p3:= project(p1, [[0,0,0], [1,0,0], [0,0,1]]); #xz-plane
  p4:= project(p1, [[0,0,0], [0,1,0], [0,0,1]]); #yz-plane
#
# Combine the original surface plot and the projected plots
# in the same figure
#
  display([p1,p2,p3,p4]);
#
# Combine the 'shadebetween' plot and the projected plots
# in the same figure
#
  display([pa,p2,p3,p4]);

 

If the calculation which you perform depends on a simple loop index, then you can use an initialiser function with the Vector definition. So for a "toy" example

a:=Vector(10, i->i^2);

will load a 10-element Vector with the 'squares' of the indices. Obviously much more complicated functions can be achieved. The one thing you can't do this way is to have a particular element depend on the result of a previous element calculation - but a 'threaded' calclulation would also fail in this circumstance. With some care you could use the above with threads.

I am wondering how we can edit a diagram plotted in maple. for example in editdiagram.mw I want name tips of diagram as "a", "b",.... and write them besides the tips on diagram.

If you could be bothered to provide the procedure/function/whatever which generated this diagram then I am pretty sure I could figure out assorted extremal points. I could then use textplot() to insert any text I want at these extremal points. Then use display() to overlay the original plot and this additional text. Such a pity that you did not upload any way of generating your plot so that I could demonstrate!

############################################################################

Another question is how we can make color different parts of a single diagram by various colors? for example in above diagram we want make blue vertical line, make green horizontal line and make black the curve line?

Could be tricky!!  depends very much on how the procedure/function/whatever which determines the plot is defined - which, of course, you are not telling anyone. Basically if a single expression defines the complete curve, then you will not be able to colour parts of it separately. If it is defined using some kind of 'piecewise' process, then individual colouring of sections may be possible

##########################################################################

I suggest you provide sufficient information for your problem to be addressed

This looks very much like an addition to

https://www.mapleprimes.com/questions/222602-Numeric-Evaluation-With-Units#comment241089

It is considered bad practice here to post a 'new' problem, when your issue is actually an extension of a previously posted problem.

However the attached file should resolve your issue. Regrettably (again), I have used Maple's 1-D input mode, which you didn't like last time (and won't like this time). I use it, because it works. You, of course, are free to use 2-D input mode??


 

#
# Initialise stuff
#
  restart:
  with(Units[Simple]):

#
# Define parameters and function
#
  F:=    2800.0*Unit(N);
  c:=    .7*Unit(kg/m);
  m__0:= 1400.0*Unit(kg);
  v__0:= 10.0*Unit(m/s);
  v:= t -> tanh((t*sqrt(F)*sqrt(c)+arctanh(v__0*sqrt(c)/sqrt(F))*m__0)/m__0)*sqrt(F)/sqrt(c):

2800.0*Units:-Unit(N)

 

.7*Units:-Unit(kg/m)

 

1400.0*Units:-Unit(kg)

 

10.0*Units:-Unit(m/s)

(1)

#
# Get the value of v() for a few arguments
# (and assign to v__e), just to check everything
# is working
#
  v__e:= v(0*Unit(s));
  v__e:= v(30*Unit(s));
  v__e:= v(60*Unit(s));
  v__e:= v(90*Unit(s));
  v__e:= v(120*Unit(s));
  v__e:= v(150*Unit(s));
#
# Plot v(t) over the range 0..160
#
  plot(v(t*Unit(s)), t=0.0..160.0);

9.999999997*Units:-Unit(m/s)

 

50.81161196*Units:-Unit(m/s)

 

61.21091188*Units:-Unit(m/s)

 

62.93620248*Units:-Unit(m/s)

 

63.19906538*Units:-Unit(m/s)

 

63.23857955*Units:-Unit(m/s)

 

 

#
# Get the value of a() for a few arguments
# (and assign to a__e), just to check everything
# is working
#
  a := t -> F*(1-tanh((t*sqrt(F)*sqrt(c)+arctanh(v__0*sqrt(c)/sqrt(F))*m__0)/m__0)^2)/m__0:
  a__e:= a(120*Unit(s));
  a__e:= evalf[5](a__e);
  a__e:= a(0*Unit(s));
  a__e:= a(30*Unit(s));
  a__e:= a(60*Unit(s));
  a__e:= a(90*Unit(s));
  a__e:= a(120*Unit(s));
  a__e:= a(150*Unit(s));
#
# Plot a(t) over the range 0..160
#
  plot(a(t*Unit(s)), t=0.0..160.0);

0.2939066600e-2*Units:-Unit(m/s^2)

 

0.29391e-2*Units:-Unit(m/s^2)

 

1.950000000*Units:-Unit(m/s^2)

 

.7090900446*Units:-Unit(m/s^2)

 

.1266121322*Units:-Unit(m/s^2)

 

0.1951720780e-1*Units:-Unit(m/s^2)

 

0.2939066600e-2*Units:-Unit(m/s^2)

 

0.4410268000e-3*Units:-Unit(m/s^2)

 

 

#
# Get the value of s__a() for a few arguments
# (and assign to s__e), just to check everything
# is working
#
  t__0:=0*Unit(s):
  s__a:= t -> int
              ( tanh((tau*sqrt(F)*sqrt(c)+arctanh(v__0*sqrt(c)/sqrt(F))*m__0)/m__0)*sqrt(F)/sqrt(c),
                tau = t__0.. t
              );
  s__e:= s__a(0*Unit(s));
  s__e:= s__a(30*Unit(s));
  s__e:= s__a(60*Unit(s));
  s__e:= s__a(90*Unit(s));
  s__e:= s__a(120*Unit(s));
  s__e:= s__a(150*Unit(s));
#
# Plot s__a(t) over the range 0..160
#
  plot(s__a(t*Unit(s)), t=0.0..160.0);

proc (t) options operator, arrow; Units:-Simple:-int(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-tanh(Units:-Simple:-`*`(Units:-Simple:-`+`(Units:-Simple:-`*`(Units:-Simple:-`*`(tau, Units:-Simple:-sqrt(F)), Units:-Simple:-sqrt(c)), Units:-Simple:-`*`(Units:-Simple:-arctanh(Units:-Simple:-`*`(Units:-Simple:-`*`(v__0, Units:-Simple:-sqrt(c)), Units:-Simple:-`/`(Units:-Simple:-sqrt(F)))), m__0)), Units:-Simple:-`/`(m__0))), Units:-Simple:-sqrt(F)), Units:-Simple:-`/`(Units:-Simple:-sqrt(c))), Units:-Simple:-`=`(tau, t__0 .. t)) end proc

 

0.

 

1011.602130*Units:-Unit(m)

 

2734.456315*Units:-Unit(m)

 

4604.288118*Units:-Unit(m)

 

6497.492630*Units:-Unit(m)

 

8394.234320*Units:-Unit(m)

 

 

 

NULL


 

Download unitProb3.mw

If I simplify everything by using 1-D input (no smart plots, palette entry etct, etc), so that I just type exactly what I want to be calculated, then everything seems to work as expected, as in the attached


 

#
# Initialise stuff
#
  restart:
  with(Units[Standard]):

#
# Define parameters and function
#
  F:=    2800.0*Unit(N);
  c:=    .7*Unit(kg/m);
  m__0:= 1400.0*Unit(kg);
  v__0:= 10.0*Unit(m/s);
  v:= t-> tanh((t*sqrt(F)*sqrt(c)+arctanh(v__0*sqrt(c)/sqrt(F))*m__0)/m__0)*sqrt(F)/sqrt(c);

2800.0*Units:-Unit(N)

 

.7*Units:-Unit(kg/m)

 

1400.0*Units:-Unit(kg)

 

10.0*Units:-Unit(m/s)

 

proc (t) options operator, arrow; Units:-Standard:-`*`(Units:-Standard:-`*`(Units:-Standard:-tanh(Units:-Standard:-`*`(Units:-Standard:-`+`(Units:-Standard:-`*`(Units:-Standard:-`*`(t, Units:-Standard:-sqrt(F)), Units:-Standard:-sqrt(c)), Units:-Standard:-`*`(Units:-Standard:-arctanh(Units:-Standard:-`*`(Units:-Standard:-`*`(v__0, Units:-Standard:-sqrt(c)), Units:-Standard:-`/`(Units:-Standard:-sqrt(F)))), m__0)), Units:-Standard:-`/`(m__0))), Units:-Standard:-sqrt(F)), Units:-Standard:-`/`(Units:-Standard:-sqrt(c))) end proc

(1)

#
# Get the value of v() for a few arguments
# (and assign to v__e), just to check everything
# is working
#
  v__e:= v(0*Unit(s));
  v__e:= v(30*Unit(s));
  v__e:= v(60*Unit(s));
  v__e:= v(90*Unit(s));
  v__e:= v(120*Unit(s));
  v__e:= v(150*Unit(s));
#
# Plot v(t) over the range 0..160
#
  plot(v(t*Unit(s)), t=0.0..160.0);

9.999999997*Units:-Unit(m/s)

 

50.81161196*Units:-Unit(m/s)

 

61.21091188*Units:-Unit(m/s)

 

62.93620248*Units:-Unit(m/s)

 

63.19906538*Units:-Unit(m/s)

 

63.23857955*Units:-Unit(m/s)

 

 

NULL


 

Download unitProb.mw

Just working from the code you have posted and ignoring the irrelevant(?) comments such as

I use some commands like the evalf[10]

 

But they don't work for the definite double integral in attached file.

It leads to "Error, (in type/algfun) too many levels of recursion"

You are using the function Sin() in a couple of places. I assume that this should be sin() - note the case. If I change your Sin() declarations to sin(), then the attached works (or at least provides a value with no error - only you know whether this value is vaguely plausible!)

 

restart; P := .3846153846*(Int(Int(2.304368875*10^(-14)*(4.339583001*10^13*exp(0.9537597986e-5*sqrt(-1.000000000*10^10*r^2*cos(t)^2+1.128379167*10^10))-4.339583001*10^13*exp(-0.9537597986e-5*sqrt(-1.000000000*10^10*r^2*cos(t)^2+1.128379167*10^10))-4.13891981*10^8*exp(.9537597986*r*sin(t))*sqrt(-1.000000000*10^10*r^2*cos(t)^2+1.128379167*10^10)-4.13891981*10^8*exp(-.9537597986*r*sin(t))*sqrt(-1.000000000*10^10*r^2*cos(t)^2+1.128379167*10^10))*r/(exp(0.9537597986e-5*sqrt(-1.000000000*10^10*r^2*cos(t)^2+1.128379167*10^10))-1.*exp(-0.9537597986e-5*sqrt(-1.000000000*10^10*r^2*cos(t)^2+1.128379167*10^10))), t = 0. .. 2.*Pi), r = 0. .. 1.062251932))

``

evalf(P)

 

``


 

Download doInt.mw

Since you don't provide expressions for the actual plots which you want, I can't guarantee to fix them :-(

If you want a quick lesson on how to plot more or less tickmarklabel you want, at more or less any tickvalue you want, in more or less any font you want, then examine the following carefully

   restart;
#
# Produce a plot where every tickmark (on x and y)
# is specified explicitly
#
   plot( x^2,
            x        = 0..4,
            axesfont  = [times, bold, 20],
            axis[1]     = [tickmarks=[0.5="0.500", 1.5="1.50", 3="3", 3.5="A"]],
            axis[2]     = [tickmarks=[3="3.00", 7.5="B", 15="15.000"]]
         );
#
# Now do the above in a more-or-less programmatic way
# where the 'format' of the x-axis tickmarks is being
# controlled. (Obviously I could do something similar
# with the y-axis tickmarks)
#
   xvals:= j$j=0.5..3.5:
   xreps:= [seq( xvals[j]=sprintf( "%4.3f", xvals[j]), j=1..4)]:
   plot( x^2,
            x        = 0..4,
            axesfont = [times, bold, 20],
            axis[1]    = [tickmarks=[xreps]],
            axis[2]    = [tickmarks=[3="3.00", 7.5="B", 15="15.000"]]
         );

If the above does not answer you question, then please provide equations for the 'curves' which you want (in a plottable form, so everything defined), together with a lists of x-axis and y-axis tickmarks which you want, in the formats you want

First 113 114 115 116 117 118 119 Last Page 115 of 162