Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 29 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

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.

The following code shows that there are no solutions where all the variables are distinct integers between 3 and 14. The key idea in the code is that if a valid solution exists then the set formed by evaluation of all the variables will be the set {3, 4, ..., 14}.

restart;
n:= 0:
Domain:= {$3..14}:
Basic:= {F,H,J,K,L}:
Nonbasic:= {A,B,C,M,E,G,N}:
Eqs:=
     {A = 33 - K - L, B = 1 + F - J, C = -15 - F + J + K + L, M = 15 + H - K,
     E = 16 - F - H + J + K, G = 34 - H - J - L, N = 18 - J - K}
:
for s in combinat:-permute(Domain, 5) do
     if {s[]} union eval(Nonbasic, eval(Eqs, Basic =~ s)) = Domain then
          n:= n+1;
          Sols[n]:= s
     end if
end do:
n;

                           0

 

 

You need to change cos x to cos(x). All function calls need parentheses is Maple.

Maple's own BVP solver works fine on this problem.

epsilon:= L[1]:
Sol:= dsolve({eq1,eq2,bcs1,bcs2}, numeric, method= bvp[midrich]):
plots:-odeplot(Sol, [[eta,f(eta)], [eta,theta(eta)]]);

NoNegatives:= (sol::set, Vars::list(name))-> ormap(v-> eval(v, sol) < 0, Vars):
remove(NoNegatives, remove(has, [sol], I), [a,b]);

You can do two things. The first is to load the plots package:

with(plots);

The second is to refer to the package without loading it by changing implicitplot3d to plots:-implicitplot3d.

@micahdavid Maple refuses to do your integral, but that has nothing to do with you having used indexed variables. Indeed, the integral is clearly improper and easily shown to be divergent. Note that when x[2] = 2, the inside integral is 0, and you're dividing by it.

You're approaching it the wrong way. Here's how to use a seq declaration for your edges. The following procedure takes a graph and any number of edges and returns true if there's more than one edge and all the edges have a common vertex.

proc55:= proc(G::Graph, E::seq(set))
     if not {E} subset GraphTheory:-Edges(G) then
          error "Found an edge not belonging to the graph."
     end if;
     evalb(nops({E}) > 1 and `intersect`(E) <> {})
end proc:

G:= GraphTheory:-CompleteGraph(5):
proc55(G, {1,2}, {2,3}, {5,2});
                             
true
proc55(G, {1,2}, {2,3}, {3,4});
                            
false
proc55(G, {1,2}, {2,3}, {3,6});
Error, (in proc55) Found an edge not belonging to the graph.

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