6523 Reputation

17 Badges

10 years, 138 days

MaplePrimes Activity

These are answers submitted by tomleslie

You don't say how you are running this test (no code!), but Matalb will use hardawre floating point arithmetic by default ..... and Maple won't.

Try defining the matrices using

Matrix(100,100,(i,j)->rand(), datatype=float[8])

and run the test again

You don't really have three equations in three unknowns - you have three equations in one unknown. Consider your equations with a simple substitution, as in

# The equations OP wishes to solve are
  eqs:={ 53.50000000+26.50000000*exp(-34.55372656*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 56.15,
         53.50000000+26.50000000*exp(-17.01469059*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 64.1,
         53.50000000+26.50000000*exp(-8.094482719*k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)) = 72.05
# Now with a simple substitution, one can write these
# equations as
  eqs2:=subs( k*h__1*h__2/(8658.242188*k*(h__1+h__2)+8.658242188*h__1*h__2)=z, eqs);

This generates three equations in one unknown - and these cannot be simultaneously solved

I don't reallly understand your problem - see the attached

First of all I agree with vv - your model can only generate values in the range [-infinity..1], and the values of yor dependent variable are in the range [0..~100]. Axel's suggestion that y-values should be interpreted as percentages, bringing there range to [0..1] seems the most plausible explanation. However it doe not explain the parameter values yu claim to have recieved from Excel

The attached file generates plots from Statistics/Fit, DirectSearch/DataFit, and using the values yu claim to have obtained from Excel.

Assuming all y-values should be divided by 100, then Fit and DataFit agree, and I suppose the quality of the fit is not too bad.

No combination of the the data and the parameters which you claim to have obtained from Excel produces fits which are anything other than appalling


In the first line of your code you have w = 0.02. It should be w := 0.02

Also your boundary conditions are defined at eta=0, eta=5. You cannot therefore produce a plot which extends to eta=10. Maple will produce a warning about this and restrict the plot range to 0..5

I changed 'mu' in the definition of omega2'(x) to 'm' (I guessed what you meant!). Worksheet now executes, but hits a maxfun limit, which is trivial to remove/overcome. Not worth doing until you confirm what you meant by the 'mu'

Op has been asking this question in varous forms for a long time. See

Answers have been provide to all of the above questions, which OP has largely ignored. I therefore have little hope that the OP will be able to use/interprret the attached in any meaningful way - even although

  1. It answers the current question
  2. It is written in as "simple" a form as I can manage - trust me I could get shorter/neater/whatever, if I wanted to

I looked at this cos I thought there must be a really easy way. Guess what, I was wrong - unless one exists which I couldn't find or figure out.

Anyhow my (unpleasant) solution to this problem is

f:=proc(expr, var)
        local ulim, llim, cond,j;
        for j from 1 by 1 to 2 do
            cond:= `or`( op([j,0], expr)=`<=`,
                         op([j,0], expr)=`<`
            if   op([j,1],expr)=var
            then if   cond  
                 then ulim:=op([j,2], expr)
                 else llim:=op([j,2], expr)
            else if   cond
                 then llim:=op([j,1], expr)
                 else ulim:=op([j,1], expr)
        return evalf(llim..ulim)
   end proc:

conds:=[ {theta <= Pi-arccos(-3/4+(1/4)*sqrt(13+16*sqrt(2))), arccos(3/4) < theta},

         {arccos(-3/4+(1/4)*sqrt(13+16*sqrt(2)))+Pi <= theta, theta < 2*Pi-arccos(3/4)},

         {theta <= 3*Pi-arccos(-3/4+(1/4)*sqrt(13+16*sqrt(2))), 2*Pi+arccos(3/4) < theta}
map(f, conds, theta)[];

At least the output agrees with that given by Acer!!!!

What *exactly* do you mean by DD^2, when DD is a vector?? I can think of at least three possibilities (there may be others!). The three most *obvious' solutions can be calculated as

A:=Vector[row]([seq(j, j=1..9)]):
(Pi/4)*zip( `*`, A, A);
B:=Vector[column]([seq(j, j=1..9)]):
(Pi/4)*zip( `*`, B, B);

Similarly there are many ways to do an elementwise divide. Obvious one would be

seq( entries(A/~j, 'nolist'), j in B);




will give you a 'listing' of the 'dsolve' procedure - although I'm not sure that this will reveal anything meaningful, cos you may have to delve much deeper.

So (for example), dsolve() calls a procedure identified as dsolve/FORMALSERIES', which you can check out using


But if you plan on doing this to determine everything that dsolve() checks/does, it is only fair to warn you that you will be there for a looonnnnngggggg time!


Just because alternative are good.

For your simple case, the "WildcardMatch()" suggested by Preben is probably your best bet. If you are going to be doing a lot of (more complex) pattern matching, then it may be a good idea to get your head around 'regular expressions' (aka 'regexps'), then use RegMatch()

As a trivial example consider the following, the first part of which fulfils your requirement, and the second part performs a (slightly) more complex 'alternates' search

slis:= ["abcde", "trend", "wands" , "fends", "noods", "sends", "fghij", "caper"]:
select( x->RegMatch(".e.d.",x), slis);
select( x->RegMatch(".(e|a).(d|e).",x), slis);

Regular expression matching is a very powerful tool



OP states that code was originally developed in Maple 2015.

In Maple 2015, the code

A := Array((1 .. 3)$3);

works using either 2-D input and 1-D input

On the other hand,  in Maple 2016, the 1-D input version of the code works - and the 2-D input version does not

So not only is it a problem with the 2-D parser, but it is something which used to work in 2D, but now doesn't:-(

This code is either seriously clever (in places) - or just downright weird.

I haven't got the time/energy to reverse-engineer what you are actually trying to achieve.

I have fixed the obvious problems, and it now executes, producing a large number of graphs (and a lot of other superfluous output). Whether or not thesae graphs are meaningful, I have absolutely no idea

I can get all 14 numeric roots with

eqn:=2*tan(Pi*t^2)-tan(Pi*t)+tan(Pi*t)*tan(Pi*t^2)^2 = 0;
f:=unapply(lhs(eqn), t);
while a1<2.0 do
      a1:=RootFinding:-NextZero(f, a1);


then the following should work - provided you change the filepath strings in the ExportVector() and ImportVector() commands to something appropriate for your machine

n := 40; 
h := 40;

sys1 := [ diff(x(t), t) = 2*t+1,
          diff(y(t), t) = 1+5*t,
          x(0) = 1,
          y(1) = 0
# Define a vector in which to place solutions
# OP only has three solutions, but I suppose
# might want more - define variable
  for j from 1 by 1 to nsols do
  # Compute general solution
      res := dsolve(sys1, numeric);
  # Get solution at the specified argument
  end do:
# Export solution vector to a file. NB, OP will
# have to use something appropriate for his/her
# machine
  ExportVector("D:/Users/TomLeslie/myMaple/tryVec", sols);
# Restart, clear memory etc and then import the solution
# which was previously exported, just to check


First 107 108 109 110 111 112 113 Last Page 109 of 135