dharr

Dr. David Harrington

9102 Reputation

22 Badges

21 years, 232 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

@mmcdara @jalal The "this:///..." notation refers to a file within the workbook (not a .mw file), where "this" means within the current workbook; see

this help

So I think the original problem was, as @mmcdara pointed out, that it was not a string. But you don't wand to append this to currentdir(). I think the Read needs only the "this///...", but until you upload your workbook it is hard for someone to check this. As @acer pointed out, you need to compress your workbook to a .zip file before it can be uploaded to Mapleprimes - I see you have now done that.

@sursumCorda Yes, it is very fast. Adding iterations=100 to the CodeTools:-Usage shows they are both about the same time, so the apparently much faster time is a fluctuation. Vectors of integers also can be Trimmed. 

@jalal 

NULL

NULL

restart

randomize()

A := RandomTools:-Generate(integer(range = -5 .. 5, exclude = {0}))

-3

B := RandomTools:-Generate(integer(range = -5 .. 5, exclude = {0, A}))

-2

operation := combinat:-randcomb([`+`, `-`, `*`], 1)[]

`*`

operation(A, B)

6

 

 

 

Download Qop.mw

@mmcdara I agree with the OPs observations of errors in Maple 2023. I found them hard to track down, and got confused by the gammas. But please check, you have both gamma_i and gamma__i in the gap procedure. .I usually define the ode and ic set outside of the procedure to be passed to minimize, and do eval on them within the procedure.

@mmcdara Your 

solution := tanh((1/4)*sqrt(2)*x)

is I believe the solution the OP referred to. It is an exact solution for z(0)=0, z(infinity)=1 (as verified by taking the limit), but is only an approximate solution for z(0)=0, z(15)=1.

@mmcdara It is a confusing situation - while there isn't a help page for, say, `[]`, asking for help does take you to a page that descibes the user-level equivalent. And yet there is a help page for `?[]`.

@mmcdara I think the OP wanted documentation for their usage in the form `<,>`(1,2,3) and `<|>`(1,2,3).

@mmcdara Nice analysis, vote up. While having the procedure name integraal the same as the local integraal may be confusing, it is not an error, as the procedure name is global and does not conflict with the local variable within the procedure.

ps: the loop within optimalisatie looks to me like

for i while i < 10 and 1/10 < abs(int__sim - int__ex) do

(see above)

I recently looked for the documentation for `<|>` and couldn't find any. For `<,>`( sequence ) the user level <sequence> is equivalent and turns a sequence into a column vector (or perhaps matrix if the sequence has more complicated entries). Likewise `<|>`(sequence) turns the sequence into a row vector as though you entered <a|b|c...>. Programmatically, one may have generated a sequence and then the user level <sequence> is fine, which may be the reson that `<,>` is undocumented. On the other hand `<|>` is the only way to turn a sequence into a row vector, so there is a better case for documentation here.

Of course I may have just failed to find the documentation also...

If I paste the optimalisatie code into a code edit region I get the message that maplemint got about "These local variables were assigned a value, but otherwise unused:   int__sim_min", which is correct: You calculate this quantity (which looks like int with subscript sim_min) but then do not use it.

In the code edit region there is no message "invalid left hand side of assignment", so that seems to be spurious. [Edit; as @mmcdara points out this is assigning to Gamma__i_min and Gamma__i_max]

Note that the printed code for the procedure has many things such as int__sim_min looking like int[sim_min] as though you entered them as indexed variables. But pasting the 2-D code into a 1-D region or converting it to 1-D with the context menu shows that actually they are single variables displaying with subscripts, as you presumably intended. I've never seen that before.

In a code edit region it looks like

optimalisatie := proc(t__ex, c__ex, C__0, Q, V__r, m__b, rho, R, Gamma__i_min, Gamma__i_max)
	local Gamma__i, t__sim, C__i, int__sim, int__ex, C__i_min, C__i_max, C__i0_min, C__i0_max, C__i0, int__sim_min, int__sim_max, i;
	Gamma__i := 1/2*Gamma__i_min + 1/2*Gamma__i_max;
	t__sim, C__i := CC(C__0, Q, V__r, m__b, rho, R, Gamma__i);
	int__sim := integraal(t__sim, C__i);
	int__ex := integraal(t__ex, c__ex);
	for i while i < 10 and 1/10 < abs(int__sim - int__ex) do
		Gamma__i := 1/2*Gamma__i_min + 1/2*Gamma__i_max;
		t__sim, C__i_min := CC(C__0, Q, V__r, m__b, rho, R, Gamma__i_min);
		t__sim, C__i_max := CC(C__0, Q, V__r, m__b, rho, R, Gamma__i_max);
		t__sim, C__i := CC(C__0, Q, V__r, m__b, rho, R, Gamma__i);
		C__i0_min := normalisatie(C__i_min, C__0);
		C__i0_max := normalisatie(C__i_max, C__0);
		C__i0 := normalisatie(C__i, C__0);
		int__sim_min := integraal(t__sim, C__i0_min);
		int__sim_max := integraal(t__sim, C__i0_max);
		int__sim := integraal(t__sim, C__i0);
		if 0 < (int__sim - int__ex)*(int__sim_max - int__ex) then
			Gamma__i_max := Gamma__i;
		else
			Gamma__i_min := Gamma__i;
		end if;
	end do;
	return Gamma__i;
end proc;

Since none of the variables are now indexed, you need to check that was what you intended - was C or C__i intended to be an Array or Vector, for example?

@Scot Gould In @acer's detailed explanation its clear that it isn't just the plot form. The operator call form is robust and is my first go-to solution for plot difficulties, especially not needing to think about where and how many uneval quotes are needed. It has been around for as long as I can remember, and the plot help page refers to it as "The commonly used operator form of the calling sequence," even if it might not be "traditional" :)  

@acer Thanks for the detailed explanation. (I realised later that just entering the GAMMA equivalent didn't give the same result, and so the real situation was more complicated.)

@SHIVAS There is an attempt to do an inverse transformation at the end of my worksheet, which shows how to do it. It does not succeed but Eq 22 was different, Perhaps if it agreed with Eq 22 it would work. You will need to find the error in the eqns or conditions (assuming there is an error) to proceed.

@SHIVAS Yes, I did not get the same answer in eqn 22. I do not know what is wrong. If you think an assumption needs to be changed you will need to say which assumption it is and what it needs to be changed to, or change it yourself.

@SHIVAS I get a different transformed answer, which probably can't be inverse-transformed. Please check I didn't make any mistakes.

Download laplace.mw

First 51 52 53 54 55 56 57 Last Page 53 of 100