dharr

Dr. David Harrington

7513 Reputation

21 Badges

20 years, 208 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 replies submitted by dharr

@Zeineb In Maple 2017.3 I also don't get an answer. But if I use:

bc[4] := f(L, y) = 0;

Then I get the same answer as @ecterrab but with L instead of _c5(n).

@HaHu  My only other suggestion would be to start from a much simpler model for which you can get a solution, and then gradually add complexity. 

@HaHu If you look at the des you have a tough problem - there are coefficients around 1e-6 along with others much larger. The solver works best with things of the order of 1 so you may want to scale the problem. One way to solve this error is to give an approximate solution as a starting value or use continuation. Maybe if you simplify the system setting the small terms to zero and can solve that, then you can look at what the solution looks like and suggest an approximate starting solution.

Infection_model.mw

@HaHu This is hard to diagnose without the worksheet, which you can upload with the big green up-arrow.

@wswain It's a good point. Using op and elementwise operators (the ~ thing) tends to make Maple unreadable for those who don't use it much. So I would use RowDimension rather than its op equivalent. There are also efficient ways to do things (like map) that avoid using loops. But you can write more "fortranlike" code with loops. You could for example fill a matrix with nested do loops. There is perhaps a tendency on Mapleprimes to suggest short and clever but less readable answers.

(And to answer your question on dynamic Arrays/Vectors/Matrices, you can dynamically extend these by using programmer indices - see ?Indexing Arrays)

@wswain  This might answer some of your questions about @tomleslie 's response.
 

restart;

with(LinearAlgebra):

A:=Matrix([[1,2],[3,4],[5,6]]); #list of lists Matrix construction

_rtable[18446744944491233278]

Matrix([A[1,..],A[2,..],A[3,..]]); #three rows are just next to each other

_rtable[18446744944491236158]

Matrix([A[1,..],A[2,..],A[3,..]],scan=columns); #list Matrix construction - rows below

_rtable[18446744944805409126]

Dimensions(A);
op(1,A); # same thing

3, 2

3, 2

RowDimension(A);
op([1,1],A); # same thing - first op of op(1,A);

3

3

n:=2;
`if`(n=2,A[2,..],"smile");
`if`(n=2,A[2,..],NULL);
B:=Matrix([A[1,..],`if`(n=2,A[2,..],NULL)],scan=columns);

n := 2

_rtable[18446744944805411526]

_rtable[18446744944805404910]

Matrix(%id = 18446744944805405870)

n:=26;
`if`(n=2,A[2,..],"smile");
`if`(n=2,A[2,..],NULL); # nothing so no output
B:=Matrix([A[1,..],`if`(n=2,A[2,..],NULL)],scan=columns);

n := 26

"smile"

Matrix(%id = 18446744944805407670)

f:=x->x^2; #squaring function (procedure)

proc (x) options operator, arrow; x^2 end proc

f(3);

9

map(f,A); #apply to every entry
f~(A);    #same thing

_rtable[18446744944805402254]

Matrix(%id = 18446744944805403574)

 


 

Download MatrixNotes.mw

@Carl Love Thanks. I was just being cautious. My information is probably out of date, but I had a recollection that in older versions there were some minor differences, perhaps in the maximum setting of Digits. But I don't see any differences mentioned on the website.

@Melvin Brown Looks like you split it into real and imaginary parts. Probably a good idea for a numerical solution, but for an analytical solution, a single complex  equation will probably work better. I'm guessing with this time dependence it's separable into a function of time multiplied by a function of (x,y). I would also probably look for a general solution first - if you can find that then add the BCs/ICs later.

Good luck.

My reading of your problem is that you don't have a way of entering inactive 2-D math, only changing active to inactive by shift-F5. In Maple 2017 (I don't have 2019), entering inactive 2-D math can be done directly with shift-F5, though perhaps you know this already ( @acer 's q1.)

 

@acer Thanks - homedir is the same on Maple and Maple Player (as expected), so I can work relative to there as a workaround.

I usually put my worksheet in the directory with the data files I want to analyze, then open files relative to worksheetdir, which for this case is the same as currentdir. This means the worksheet doesn't need to be modified if I send it to to someone else who operates the same way. In an interactive application I can use a combo box to list the files in worksheetdir and the user can choose one, not having to change or choose a directory.

@ALIKHADEMI to make variable "a" a Vector, use a:=Vector([seq(1..10,0.5)]);

The rest of the code is the same. I don't understand the rest of your question. To better understand elementwise operators, take a look at the help page for elementwise.

@pu397 You'll have to use Eq 27 or the like instead of Eq. (12). I didn't spend much time trying to understand the method, just suggested the general strategy for using Maple. I'm currently travelling, so don't have much time, so suggest you make a first attempt, and pehaps someone here can help correct it for you.

@Carl Love Thanks for the tip.

@acer @nm This is often (usually) a hidden file.

@acer I like to let the OP do some of the work :-). My variation would have been to solve some eqns:
 

Gc := (s^2*t^2+2*s*t*x+1)*(-b*s+1)/(k*(-b*s+1)*s*(t*c+b));

(s^2*t^2+2*s*t*x+1)/(k*s*(c*t+b))

Gc2:=expand(convert(Gc,parfrac,s));

t^2*s/(k*(c*t+b))+2*t*x/(k*(c*t+b))+1/(k*s*(c*t+b))

eqns:={A=coeff(Gc2,s,0),A*C=coeff(Gc2,s,1),A/B=coeff(Gc2,s,-1)};

{A = 2*t*x/(k*(c*t+b)), A/B = 1/(k*(c*t+b)), A*C = t^2/(k*(c*t+b))}

ABC:=solve(eqns,{A,B,C});

{A = 2*t*x/(k*(c*t+b)), B = 2*t*x, C = (1/2)*t/x}

Gc3:=A*(1+1/(B*s)+C*s);
simplify(eval(Gc3,ABC)-Gc);

A*(1+1/(B*s)+C*s)

0

 


 

Download parfrac.mw

First 64 65 66 67 68 69 70 Last Page 66 of 77