5615 Reputation

17 Badges

10 years, 12 days

MaplePrimes Activity

These are answers submitted by tomleslie

Once upon a time the limit on the number of columns in an Excel file was 256: anything in the .xls file format was restricted to 256 columns

Somewhere around Excel2007 the number of allowed rows/columns in an Excel spreadsheet was greatly increased - I think it is now 16384 columns (provided you are using .xlx files)

However, for reasons I do not know, Maple still seem to be applying the restriction of 256-column output. Probably a good idea if one assumes "old" Excel installations and a bad idea for more modern ones.

The simplest workaround is to split your matrix in two, with 150 columns in each, then export these to two separate worksheets in the same Excel file. As an example, the following will work for a 300x300 matrix

XLM:=LinearAlgebra[RandomMatrix] (300,300);
ExcelTools[Export](XLM[1..300, 1..150], "J:/Users/Tomleslie/myMaple/xlTest.xls", "A"):
ExcelTools[Export](XLM[1..300, 151..300], "J:/Users/Tomleslie/myMaple/xlTest.xls", "B"):

Obviously you will have to change the file path/name to something appropriate for your system. However the result will be an Excel workbook with two worksheets 'A' and 'B'. If you really want these in a single workhseet, then you can perform a simply cut/paste operation within Excel (assuming you Excel is post 2007-ish!)

In the absence of a return statement, procedures will return the output of the last evaluated statement - so in your exaample, you will get the value of solve05(ll):

On the other hand if you use an explict return statement, as in

           local ll,r,r1,r2,r3;
           return solve01(ll),

this will return the values solve01(ll), solve02(ll), solve03(ll), solve04(ll), solve05(ll), as a sequence

Try reading the help page for proc() which states quite clearly

The value of a procedure invocation is the value of the last statement executed, or the value specified in a return statement.

According to the manual

The packages() calling sequence returns a list of the packages bound using the with command. The packages are listed in the order that they were bound.

You need to tell maple that the function q1(t) has units of Coulombs, and similarly diff(q1(t), t) has units of coulombs/sec (or amperes if you prefer). The following executes

R := 500*Unit(ohm);
C := .5*Unit(microfarad);
V := 20*Unit(volt);
ode := R*diff(q1(t), t)*Unit(coulomb)/Unit(second)+q1(t)*Unit(coulomb)/C = V;

but the result for q1(t) is displayed without units :-(

I've tried a few variations of the above, same outcome

I obviously misunderstood - still you could use

   convert(taylor(y(x+h), h=0, 4), polynom);

where the last line is only necessary if you don't happen to like D-operator format

I think that the fundamental issue is with the value of numpoints - you are "subsampling" the ode solution for plotting purposes - which makes the plot *look* really weird: I (rather arbitrarliy) set numpoints=10*tmax, in an attempt to ensure that I always got the same number of point on each cycle, regardless of the number of cycles performed: this seemd to make things *appear* more sensible.

I thought that using dsolve/odeplot might give simpler control over numeric errors compared with DETools/DEPlot - this doesn't *seem* to be true. Both give approximately the same answers up to tmax=2000 (with numpoints=10*tmax), although I do have to explicitly remove the maxfun limit in the dsolve() command.

From around tmax~800, one can start to see error issues, although both solution methods still show the solution in the limit cycle

I tried it all the way up to tmax=2000 and the solution stays within the limit cycle.

See attached

Don't have Mathematica so can't really check, but as far as I can tell

  1. Maple imports .mma, but does not export it
  2. Mathematica does not import or export .mw(s)
  3. So only option would seem to be: pick a format both support - eg mathML(?). Maple exports it and Mathematica imports it. I suspect that success/failure of this approach depends on the "complexity" of the info to be exported/imported

From maple MathML:-Export

appears to work (no messgaes/complaints) for both of the expressions you quote.

Like I said earlier, I can't check whether Mathematica's mathML import, will import/convert correctly

The attached runs in about 0.25secs on my machine and produces plausible-looking plots


I think there may be a few problems with the code you posted

  1. if you want 3.14159... you have to use Pi everywhere, not pi
  2. there seems to be a missing operator in the expression

#funzione desiderata
Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p));
arctan(tan(q), 1 - 0.3055555556 tan(q))      <--  6 tan ?????

If I use Pi for pi throughout, and replace the above snippet with

#funzione desiderata
Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p));
arctan(tan(q), 1 - 0.3055555556 * tan(q))

Then NLPsolve still returns the error message

Error, (in Optimization:-NLPSolve) abs is not differentiable at non-real arguments



DirectSearch[Search](rms, [z = -0.4..0,
                                         alpha0 = 0..Pi/3,
                                         alpha1 = Pi/2..5*Pi/4,
                                         l1 = 0.3..1,
                                         l2 = 0.001..0.3,
                                         l3 = 0.01..0.3


1.20098330185160, [alpha0 = 9.10801161719342*10^(-8), alpha1 = 1.57079638010262, l1 = .496239599198213, l2 = .260891601089832, l3 = 0.100000115197816e-1, z = -0.841913363553979e-2], 84]

If I understand your requirement correctly, then the attached performs the relevant calculation. Results aren't very exciting though!

  1. Why use partial derivative symbols when you seem to have functions (u and v) of only one variable?
  2. You have to make the function dependencies obvious - easiest way is to write u(x), v(x)

See the execution groups I have added to your worksheet

Since it seems(?) that you want to plot *real* values (which Maple won't assume), then you could use

plot(x^(1/3), x=-1..1);
plot(x^(4/3)*sin(1/x), x=-1..1)

  1. Don't understand why you have defined your own atan2() function because Maple already has always had an inbuilt 2-element arctan() function, although you will have to multiply by 180/Pi if you want it in degrees
  2. The builtin functions min[index](A) and max[index](A) wil return the index values of minimum (maximum) elements for pretty much any indexable structure A- list, array, matrix whatever. I believe that this functionality was added for Maple 2015, so if you have an earlier version.......
  1. I commented out the forget(evalf) and Digits() commands because I don't think you need them. Uncomment them if you want to
  2. I added some plot options (color, symbol) so that I/you could easily tell which plot was being generated by which command

So just run the attached

  1. The function ge() is not doing what you think! ge(x,y) returns 1 if x>=y and 0 otherwise. You should be using >=.
  2. However making the above change does not solve your problem. As the manual says "The isolve command has some limited ability to deal with inequalities"
  3. You can however use solve() with assumptions, as in

n := 2;
solve(sum(a[k], k = 1 .. n)-1 = 1, useassumptions) assuming a[1]::nonnegint, a[2]::nonnegint;

First 108 109 110 111 112 113 114 Last Page 110 of 123