Joe Riel

9660 Reputation

23 Badges

20 years, 4 days

MaplePrimes Activity


These are answers submitted by Joe Riel

Those are really old worksheets. Maple used to distribute an executable, updtsrc, for updating old worksheets to a newer format, however, that hasn't been needed since Maple 6, so is no longer distributed (I believe).

The equation of the "force" is incomplete.  What is R?  What is UOXB? Probably you wrote a vector using angle-bracket notation, but the html doesn't display that.

You want to find x such that it is a member of the kernel, or nullspace, of A.  See ?LinearAlgebra[NullSpace]. It returns a set of vectors that correspond to a basis for the kernel.  Any linear combination of the vectors in the kernel satisfy the equation (A.x=0).

The error is occurring in TrapRule, which isn't shown here.

There are various minor issues with the above code. The type-checking conditionals aren't quite correct in that they won't raise an error if m or n is not numeric. Also, ERROR is deprecated in Maple, use ?error. The while-statement works, but really should be an if-statement.

If there is no requirement for the precise error message, you may use parameter type declarations for part of the error checking:

RombInt := proc(f, a, b, m::nonnegint, n::nonnegint)
...
end proc:

To issue an error when m > n, add the following conditional at the start of the procedure body

if m > n then
   error "parameter m must be less than or equal to n";
end if;

See the help page for ?error.

 

Use the "Z" modifier.  For example,

printf("%5.3Zf\n", 5+3*I);
5.000+3.000I

See ?printf

It works for me using Debian (Squeeze, stable) with Maple 15. Are you sure the browser is configured properly in Maple?  To select a browser in the Standard GUI, click Tools --> Options --> General --> Browser and select the browser.  To test it, try doing

error "testing";

The resulting error message should be a hyperlink. Clicking on it should cause the browser to open to a Maplesoft online help page. Clicking on the link doesn't necessarily give the browser the focus, you may have to manually change to the browser.

This is a round-off issue.  You might first try modifying the assignments to L and v so that they are exact fractions, rather than floats. Then call fsolve with ?Digits := 50 or thereabouts.

Put the procedures in a startup region. Click on the gear-like symbol on the toolbar.

You can use a ?try catch statement to handle exceptions.

try
    ...
catch:
   go here if an error occurs above
end try;

 

 

First, Maple expresses angles in radians rather than degrees. See ?convert,degrees for a method for converting. Second, you might want to check your interpretation of the law of cosines.  The denominator is incorrect

Try using ?plottools[getdata].  For example,

plt := plot3d(sin(x)^2/(2+cos(y)^2), x=0..Pi, y=0..Pi):
pts := plottools:-getdata(plt)[3]:
(min,max)(pts);
                    0., 0.500000000000000000

Posting the code would help.  Note that after completing the loop

for i from 1 to 15 do
  ...
end do;

the value of i is 16 (not 15).  If you later using i without reassigning it then there could be an issue.

I don't know much about bifurcation diagrams other than what I picked up from a quick read of Wikipedia, so don't trust the following without verification.  The idea is to solve for B at equilibrium, which means the diff's are all 0.  To that, I'll first enter the system in proper Maple syntax:

sys := { NULL
, diff(A(r),r) = k + m * Y(r) - A(r) * B(r) * B(r) - A(r)
, diff(B(r),r) = 1/q * (A(r) * B(r) * B(r) + A(r) - B(r))
, diff(Y(r),r) = 1/s * (B(r) - Y(r))
}:

params := {NULL
, k = 10
, q = 5 * 10^(-3)
, s = 2 * 10^(-2)
}:

Next, modify the equations so that the diff is replaced with 0

equil := eval(sys, diff=0):

Use solve to solve the equations

sol := solve(equil, [A,B,Y](r));
(m - 1) k k k
[[A(r) = - -----------------, B(r) = - -----, Y(r) = - -----]]
2 2 m - 1 m - 1
k + m - 2 m + 1

Finally, extract the rhs of B(r), substitute the parameter values, and plot

plot(subs(sol[1], params, B(r)), m = 0..0.18);


Using system("start ...") on Windows seems the easy way to go.  Things are more complicated in *nix-land, where there isn't a universal way to launch a system browser.  Here I hacked up a procedure, OpenBrowser, and a module (MapleConfig, used to find browser executable from config file in *nix) that should work with either Windows, Linux, or Mac, though I haven't tested on the Mac.

OpenBrowser := proc(uri :: string)
local browser,cmd,platform;
platform := kernelopts('platform');
if platform = "unix" then
browser := MapleConfig:-Get("Browser", 'strict');
elif platform = "windows" then
browser :="start";
else
error "do not know how to access browser";
end if;
cmd := sprintf("%s %s %s", browser, uri
, `if`(platform = "unix", "&", ""));
system(cmd);
NULL;
end proc:

module MapleConfig()
export Get, ConfigFile;
local MajorVersion;

Get := proc( field :: string
, { strict :: truefalse := false }
, $
)
local configfile
, line
, match
, val
;
uses FT = FileTools;
configfile := ConfigFile();
if not FT:-Exists(configfile) then
error "could not find config file '%1'", configfile;
end if;
match := cat(field,"=");
try
do
line := FT:-Text:-ReadLine(configfile);
if line = NULL then
error "field %1 not found in config file";
end if;
if SearchText(match, line) = 1 then
break;
end if;
end do;
finally
FT:-Text:-Close(configfile);
end try;
val := line[length(match)+1..];
if strict and val = "" then
error "no value given in configuration file for %1", field;
end if;
return val;
end proc;

ConfigFile := proc()
StringTools:-Join([kernelopts('homedir')
, ".maple"
, MajorVersion()
, "maplerc"
], kernelopts('dirsep')
);
end proc;

MajorVersion := proc()
local ver;
ver := convert(kernelopts('version'),string);
substring(ver, SearchText(" ",ver)+1 .. SearchText(".",ver)-1);
end proc;

end module:
First 47 48 49 50 51 52 53 Last Page 49 of 114