dharr

Dr. David Harrington

8507 Reputation

22 Badges

21 years, 41 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

M := ExcelTools:-Import(cat(currentdir(), "/Data.xlsx"))

Generates a Matrix from the whole file. You can also specific a selection to import. The Matrix can be split into columns in various ways, depending on the names you want and what sort of variable. For example, for the first column as a Vector.

tim:=M[..,1];

To put 10 columns into variables x1,...x10

cat(x, 1 .. 10) := LinearAlgebra:-Column(M, 1 .. 10)

 

Using 

disk([x0,y0],0.06,color=black)

from the plottools package is clearer, both on the screen and in the .pdf export. I tried to find the reason by exporting to .eps and looking more closely in Coreldraw, but then they look the same, so the export process must work differently.

Following up on @acer's, suggestion, the following appears to work, but I'll let you check the bits to see if they are correct.

Download float.mw

Use

fprintf(fd,"%a",u11);
close(fd);

Edit: If you need the "u11:=", then that is

fprintf(fd,"u11:=%a",u11);
close(fd);

I interpret your x1prime as a derivative with respect to time, and assume the partial derivatives don't depend explicitly on time. Then the equations you give aren't really relevant, and something like the following works.

de1:=diff(H(x,y),x)=2*x*y^3;
de2:=diff(H(x,y),y)=3*x^2*y^2;
pdsolve({de1,de2});

{H(x, y) = x^2*y^3+_C1}

Download pdsolve.mw

The inttrans package in my version of Maple (2015) does not work this one out, but it can be worked out step by step using Cauchy's residue theorem.

Edit: redone to use strict upper half plane.

Download Fourier.mw

Here I read the whole file in as a string and then process it (including removing all the spaces). If you really have huge files, then reading line by line as in @mmcdara's answer is superior. But either way, I think the use of sscanf or fscanf helps.

readdata.mw

 

How about

foo:=proc(n::integer);
  if n=0 then
     return FAIL
  else
     return 1,2;
  fi;
end proc:
L:=foo(6);
if L<>FAIL then
  A,B:=L;
end if;

This also works if you return a list and use A,B:=L[]; 

If you really like the call form a,b:=foo(), then you could just return FAIL,FAIL and test A for FAIL.

The nonlinearsimplex method does not use derivatives and so can avoid this problem. But it can't do bounded problems. It finds the maxima at x=0, but these go to infinity, so not sure what you really want here. To find those, just look for where the reciprocal goes to zero, e.g., with fsolve.

plot.mw

restart;
with(GraphTheory):
G:=CycleGraph(4):
SetVertexPositions(G,[[0,0],[1,1],[2,0],[1,-1]]):
G:=RelabelVertices(G,["left","top","right","bottom"]):
DrawGraph(G);
ChromaticPolynomial(G, 5);

260

Download Flag.mw

You can recklessly force this, or play it safe with CancelInverses.

SolveTools:-CancelInverses(arcsin(sin(x)));

x
 

SolveTools:-CancelInverses(arcsin(sin(x)),'safe');

arcsin(sin(x))

 

Not sure I exactly understand how the code in test.mpl is being run. The command currentdir() finds the path of the currently running file (usually a (preexisting) worksheet but perhaps running from a command prompt?), and the subdirectory can then appended.

In my old version 2015, there are no multigraphs or loops, so the code for RandomDigraph produces only simple graphs. Here it is.

DiGraph.mw

I put the PDEs and conditions etc in the correct form, reduced the number of initial conditions to one, (one dt) and the number of boundary conditions to one (one dx). Then it says "Error, (in pdsolve/numeric/match_PDEs_BCs) cannot handle systems with multiple PDE describing the time dependence of the same dependent variable, or having no time dependence". My interpretation is that since the first PDE doesn't have any time derivatives, it can't be handled.

pdsolve_numeric.mw

In my (older) version of Maple simplify(CONV_2) works.
 

CONV_2 := 2*f__2(r, theta, phi)*v__r/(r*sqrt(r^4*sin(phi)^2))+`v__&phi;`*(diff(f__2(r, theta, phi), phi))/sqrt(r^4*sin(phi)^2)+`v__&phi;`*f__2(r, theta, phi)*(diff(1/sqrt(r^4*sin(phi)^2), phi))+cos(phi)*f__2(r, theta, phi)*`v__&phi;`/(sin(phi)*sqrt(r^4*sin(phi)^2))+(diff(f__2(r, theta, phi), theta))*`v__&theta;`/sqrt(r^4*sin(phi)^2)+v__r*(diff(f__2(r, theta, phi), r))/sqrt(r^4*sin(phi)^2)+v__r*f__2(r, theta, phi)*(diff(1/sqrt(r^4*sin(phi)^2), r)):

simplify(CONV_2);

-(cos(phi)^2-1)*(`v__&phi;`*(diff(f__2(r, theta, phi), phi))+(diff(f__2(r, theta, phi), theta))*`v__&theta;`+v__r*(diff(f__2(r, theta, phi), r)))/(sin(phi)^2*(r^4*sin(phi)^2)^(1/2))

``

Download simplify.mw

First 38 39 40 41 42 43 44 Last Page 40 of 83