Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 310 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

What you are trying to do only makes sense to me if E is sorted. So, assuming that E is sorted, a binary search will be much faster in the long run than the linear searching already mentioned. What you want is

1+ListTools:-BinaryPlace(E,x);

Example:

E:= [0,2,7,15,26,40]:
1+ListTools:-BinaryPlace(E,5);
               3

I'll show you a way to get the reduced row echelon form and leave it up to you to interpret it.

A:= < 1,2,3,1; 4,5,6,1; 7,8,9,1 >:

(How did I get that matrix from your equations?)

MTM:-rref(A);

The above command is equivalent to LinearAlgebra:-ReducedRowEchelonForm but is a lot less to type.

Include

with(Optimization):

at the top of your worksheet.

 

Enclose the _X in single back quote characters, like this: `_X`. On American keyboards, this character is in the upper left corner, under Escape. Anything inside the quotes is treated as a variable, regardless of any other meaning(s) that the characters have.

Use square bracket indexing for subscripting and exponents (via ^) for superscripting. Here's an example:

plot(x^2, x= -1..1, labels= [x[old], x[old]^2], labelfont= [TIMES,ITALIC,16]);

Maple will do the integral easily if you assume x > 0. I also changed the floating-point constants to exact rationals, although this is not strictly necessary.

Int((x-tau)^(1/2-1)*(tau^2+tau^(3/2)*8/3-tau-2*tau^(1/2)), tau= 0..x);

value(%) assuming x > 0;

What do you mean by (x)(x)? Do you mean x times x? That should be either x*x or x^2. Juxtaposition does not imply multiplication. Extraneous parentheses do imply function calls, i.e., (x)(x) is treated as if x were a function with itself as the argument.

The numeric constant 5.6*10^-4 needs to be 5.6*10^(-4) or, better yet, 5.6e-4.

solve(5.6e-4 = x^2/(0.2-x), x);

Change your code to this:

restart:
with(DEtools):
a := diff(y(x), x) = exp(-0.1e-1*x*y(x)^2);
dfieldplot(a, y(x), x = -8 .. 8, y(x) = -8 .. 8, color = exp(-0.1e-1*x*y(x)^2));

I corrected several errors. I changed e(x)^ to exp. I changed xy to x*y(x). There is no implied multiplication by juxtaposition in Maple; xy is treated as a variable distinct from x or y. The exponential function is exp; e has no pre-assigned meaning on input, although it is used in the usual mathematical sense on output. In differential equations, the dependent variable must always be used as a functiony(x) rather than simply y.

It can only be plotted for integer values of k because it involves a negative number to a variable power, which is in general complex. The following plot command will work:

plot([seq([k,RR(k)], k= 2..10)], style= point, symbolsize= 16, view= [2..10, 4..7]);

ceil(fsolve(Pi^2/6 - sum(1/n^2, n= 1..N) = .001, N));

                                        1000

Example:

ex:= 7*diff(eta1(xi1), xi1)+8*diff(eta2(xi2), xi2)+9*eta1(xi1)^2;

 coeff(ex, diff(eta1(xi1), xi1));

                        7

From this we learn the interesting fact that linestyle and thickness aren't independent: The thickness affects not only the width but also the length of the segments (including the blank segments) for the segmented linestyles. So, when the thickness is large, the segmented linestyles look ridiculous.

plots:-display([
     seq(seq(
          plot(exp(-x^2)*sin(Pi*x), x= -2..2,
               thickness= T, linestyle= L,
               caption= sprintf("Linestyle = %d, thickness = %d", L, T)
          ), T= 0..70), L= 0..7)
     ], insequence= true
);

You shouldn't use I as a variable because it is reserved as the complex unit. So, I changed that to i

You can use the solve command to solve an equation, like this:

restart:
eqn:= U = i*R:
Soln:= R = solve(eqn, R);

You make Rthe second argument to solve because you want to solve eqn for R. The way that I wrote the solve command will only return the right side of the solved equation. That's why I put R = in front of solve.

Rather than a loop, use select, like this:

tneighbors:= proc(G::Graph)
description "Returns the set of vertices of degree two of a graph.";
uses GT= GraphTheory;
     {select(v-> GT:-Degree(G,v) = 2, GT:-Vertices(G))[]}
end proc:

Vertices returns a list of vertices rather than a set. The result of the select is thus a list. To convert a list L to a set, do {L[]}.

It is slightly more difficult to return a set or a list from a loop, although it is often necessary. Acer provided an example of how to handle that, returning a "table" from the loop and then converting it to a set. I would avoid the suggestion of Axel because it is a bad habit to start, and it is extremely inefficient when the set size is large.

 

 

The line that defines currentvertex needs to end with a semicolon.

Also, you should include the line

uses GraphTheory;

as the second line of your procedure.

First 288 289 290 291 292 293 294 Last Page 290 of 395