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

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.

v1:=<1,2,3,4,5,6,7,8>:  v2:= <9,10,11,12,13,14,15,16>:
cols:= 10:
M:= Matrix(8,cols):
M[.., 1]:= v1:  M[.., -1]:= v2:

The reason that the second run produces different results is that when you re-execute an assume command (without an intervening restart), weird things happen. There is some combination of assumptions that will cause your integral to be done. I am trying to figure out what that combination is so that you can enter it directly. The situation is further complicated by your use of both assume and assuming on the same variables.

I think that the assumptions that various variables are constant are not needed.

Student:-Calculus1:-Roots(sin(x)^2 = exp(-x)*cos(x), x= -5..15, numeric);

You are using the feasible command from the simplex package and the LPSolve command from the Optimization package. So you are not getting contradictory results from the simplex package. Try using minimize from the simplex package. (This may take too much time.) The problem with LPSolve may be one of precision: It may work if you increase Digits, or specify method= activeset.

Please provide a worksheet if you need further help.

Include the following in your initialization file:

Histogram:= proc({frequencyscale:= ':-absolute'})
     Statistics:-Histogram(_rest, ':-frequencyscale'= frequencyscale)
end proc:
protect(Histogram):

Then when you want to use it, invoke :-Histogram regardless of whether Statistics has been loaded (with with).

remove(has, indets(T), x);

Here is a little procedure that you can use that will take any expression, find the floats that have zero fractional part, and convert those floats to the corresponding integer. It will also find floats with trailing zeros and truncate those zeros. If you apply this to expressions before making a comparison, then they will compare as equal when you want them to. You may find this more convenient than using verify.

 

NormalizePointZero:= (expr::anything)->
     subsindets[flat](
          expr, float,
          proc(x::float)
          local m, e, q;
               if x=trunc(x) then trunc(x)
               else
                    (m,e):= op(x);
                    while irem(m,10,'q') = 0 do e:= e+1; m:= q end do;
                    Float(m,e)
               end if
          end proc
     )
:    

S:= {20, 20., 20.00, 20.5, 20.50};

{20, 20.00, 20., 20.50, 20.5}

(1)

NormalizePointZero(S);

{20, 20.5}

(2)

Comparison:= [20] = [20.];

[20] = [20.]

(3)

``

evalb(Comparison);

false

(4)

evalb(NormalizePointZero(Comparison));

true

(5)

evalb(20.5*x+20 = 20.50*x+20.);

false

(6)

evalb(NormalizePointZero(20.5*x+20 = 20.50*x+20.));

true

(7)

``

 

Download Normalize_point_zero.mw

If you tell Maple that all the variables represent real numbers, then it recognizes the final equality as true. You do this not with the context menu but with the command

is(%) assuming real;

which must be entered immediately after the equality Q2 = ... is entered.

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