tomleslie

13876 Reputation

20 Badges

15 years, 174 days

MaplePrimes Activity


These are replies submitted by tomleslie

If you read the manula entries for subs() and algsubs() you will realise why you cannot use either in the way that you want.

These reasons are also briefly explained in the attached worksheet, which also show a way to perform the substitutions you want, with a little less typing


subsProb.mw

 

@Christopher2222 

I can resize this graph in Maple 2015

  1. When I run the code in the worksheet you uploaded, then I do not get the same answers which you display!!! I suggest you ensure you have a 'restart' command at the start of your worksheet
  2. There are a few cases of "untidy" syntax in the worksheet you uploaded: so far as I can tell none of these will cause any errors. I have commented the more obvious one in the attaxhed
  3. If I compute the solution of your ODE using the procedure you have written, and the solution of the same equation using Maple's in-built ODE solver, then the two curves overlay exactly - see attached worksheet
  4. So what exactly do you think is wrong??

RK4.mw

that "Delauny triangulation" is appropriate.

Have you tried

plot3d(x^2+y^2, x = -1 .. 1, y = -1 .. 1, gridstyle=triangular);

@Chris 

Won't do exactly what you want, but have you had a look at the "MathApps"

?MathApps

in particular

?MathApps,GraphingRationalFunctions

@Samuel Hollis

Check out the Maple help entry at ?MaplePortal,ConnectingToMATLAB(Matlab), for an overview of what you can do more or less "interactively"

You should also check out ?CodeGeneration[Matlab] to translate Maple code to Matlab code - so if you write a Maple procedure for doing something, you can convert/export this to a Matlab m-File.

The reverse process can also be be achieved, see ?Matlab[FromMFile] which will convert a Matlab m-file to Maple code

I have to admit that although I use both Matlab and Maple, I very rarely utilise their connectivity.

I think you need to understand what the Maple-Matlab link actually does. Consider the example in the Maple help page - to which I have aded a lot of comments

    with(Matlab):
# Generate some data for analysis.
    num := 1500:  # evaluated in Maple
    Time := [seq(.03*t, t=1..num)]: # evaluated in Maple
    data := [seq((3.6*cos(Time[t]) + cos(6*Time[t])), t=1..num)]: # evaluated in Maple
# Add noise to the data.
    tol := 10000: # evaluated in Maple
    r := rand(0..tol): # evaluated in Maple
    noisy_data := [seq(r()/(tol)*data[t], t=1..num)]: # evaluated in Maple
    ft := fft(noisy_data): #
                                   # Technically there is no 'fft' command in Maple.
                                   # There is a SignalProcessing:-FFT, but since
                                   # the SignalProcessing package has not been
                                   # invoked, and the Matlab package has, then the
                                   # Matlab engine will be used to compute the
                                   # relevant Fast Fourier transform and return the
                                   # result to Maple. There is no suggestion at any
                                   # point that this calculation will "appear" in any
                                   # random Matlab worksheet!!!
                                   #
                                   # The objective of this package is
                                   #
                                   # 1. to set up a problem in Matlab.
                                   # 2. use the Matlab engine to compute the result;
                                   # 3. return the solution ( computedf by Matlab) to
                                   #     Maple

You do however ask a sensible question "What good is this?!" This is a difficult question. Perhaps you believe that Matlab is "better" than Maple when performing certain calculations? This is pretty unlikely.

For all (numeric) LinearAlgebra calculations, both Matlab and Maple act as "interfaces" to the free software packages  BLAS/LAPACK (check Wikipedia for these). For any reasonably complicated linear-algebra-type calculation, the performance (in either Maple or Matlab) is entirely governed by the underlying BLAS/LAPACK - the "interface" time is likely to be insignificant

In case you think that I advocate either Maple or Matlab above the other, then I would point that I have just renewed by license contracts for both!

Maple costs me $500/yr (roughly)
Matlab costs me $500/yr (roughly)

So I don't really think I have a preference for one over the other!

@brian bovril 

I'm not sure that I can do any better than the help page, but you could have a play with the attached, which has a couple of "toy" examples (and I have commented heavily)

arrayInt.mw

Obviously the ArrayInterpolation() command has way more options/variants than are covered by these toy examples

@gkokovidis 

Changing the bincount will change the vertical scale - but if you ensure that the number of bins is the same in both the Histogram() and KernelDensityPlot() plots are the same, then they will overlay successfully.

Now explain why you are setting the 'frequencyscale=absolute' option in the Histogram() plot. This will introduce an additional scaling factor in the Histogram() plot, which will is not be used in the KernelDensityPlot().

So exactly why are you introducing this additional scaling factor in one plot and not in the other??

If you are deliberately scaling one plot and not the other - why would you then expect them to overlay?????

@acer 

Why are B and C different from A???

attrProb.mw

I really don't understand the question.

Does it have anything to with whether help pages display with 1-D math or 2-D math?

You can change this for offline help by check/unchecking the "Display Examples with 2D Math", under the 'View' tab on the help page

Don't think you can change the display format for on-line help though

@acer 

Weird!!! So far as I can tell, rhere seem to two issues which are interacting

  1. Definitely seems to be a problem of losing attributes when writingto/readingfrom a Maple archive. This is not specific to 'Units' - see the attrTest.mw worksheet attached.
  2. Didn't understand why you/OP were seeing 'attributes' on a quantity with Units: this actually only occurs if the value to which the Unit is assigned is the integer '1' - with any other numeric value, no attributes are set. This may be related to the comment I made in an earlier worksheet that if A1 := 1*Unit('m'); then this "quantity displays as A1:=m rather than A1:=1 m. Not technicallly incorrect, just *looks* odd"". To verify that attributes are only assigned when value is '1', see the unitsStrange1.mw below

attrTest.mw

unitsStrange1.mw

I only checked the above in Maple2015

@andmail 

I added a few execution groups to the following which reflect what you are doing.

I have deliberately posted a worksheet containing the output from when it ran on my machine.

Do not execute it ! Just open it and read! I assume that what it contains is what you want??? So why do we see different answers?? Possibilities are

  1. I am using Maple2015/Maple2016 (I've tried on both) on 64-bit Win7
  2. Default interface??
  3. Init files??
  4. Library files ? My libname() only uses Maple defaults. Whenever, I use an added library, this is worksheet-specific, ans is loaded from a user file - not one in the Maple installation path

Only sensible suggestion I can make at this point is that you strip out all Maple customisations which you have made, in which case if you re-execute the supplied worksheet, you should get exactly what is shown in the attached

unitsLibs2.mw

 

Carl's solution is correct: but I'm still having a problem.

Having carefully (and recursively) made substitutions to eliminate theta[1](t), theta[2](t), OP claims that "the expected result" should be

(sin(theta[1](t))-theta[2](t))*cf - (sin(gamma[1](t)-sin(gamma[2](t)))*mf  + xp[2](t) - xp[1](t) = 0

So having substituted for theta[1](t), theta[2](t), why would these quantities occur in the suggested solution?
Why does gamma0(t) "disappear"?
OP uses Psi(t) as a symbol without realising that Psi is an in-built function in Maple - this causes all sorts of minor chaos. Try typing  Psi[1](t); Psi[1](t); at a Maple prompt, and read the output very carefully, paying particular attention to subscripts. Notice that, as far as Maple is concerned, it seems as if

Psi[1](t)=Psi[2](t)=Psi[3](t)=Psi[4](t).

This might/will(?) lead to "interesting" effects when making the substitutions

psi[1](t)=Psi[1](t) - theta[1](t) + gamma[1](t),
psi[2](t)=Psi[2](t) - theta[2](t) + gamma[2](t)

Unless you are interested in the digamm/polygamma function, don't use Psi as a symbol, without first declaring it as 'local'

Having read the help page at

?Methods Used by Optimization Package;

I would say that NLPSolve with the sqp method is your only choice. In principle Maple should select this method without you having to specify it

In the methods listed in the above help page, there is no "gradient" method. The closest is probably "Modified Newton". However as the help page states, this method is only appropriate

"for unconstrained or finitely bounded problems".

First 154 155 156 157 158 159 160 Last Page 156 of 207