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

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.

You have

ResBB:= fnormal((1-B(s))/(1-Ls(s)), 10);

Change that to

ResBB:= fnormal(factor((1-B(s))/(1-Ls(s))), 10);

I have confirmed that this reduces the degree of both the numerator and denominator from 20 to 19, and that it allows you to evaluate ResBB at s=0.

You should use simplify with side relations. Let M be your Matrix. Then the command would be

map[inline](simplify, M, {2*v13*v21*v32+v12*v21+v13*v31+v23*v32 = V});

This reduces the rational function in the example that you gave, but it does not completely eliminate the indexed variables, nor do I see how it possibly could.

The command to solve that is numtheory:-pi. It is the inverse function of ithprime.

numtheory:-pi(29);

     10

The command for decimal answers is evalf. In the case that you present, use the command

evalf(%);

The % is to refer to the result of the previous command.

Using the context menus for this is a two-step process. First use Conversions -> To List, then Approximate and select the number of digits.

Edit: Answer edited due to new information provided by Preben below.

map(collect, M, [a1, a2]);

To the best of my ability to interpret what you typed, you meant what I have below. But I am still unsure what you meant by ^() (an empty exponent). Note that square brackets cannot be substituted for parentheses in Maple. If I have transcribed your equation correctly, then it can be easily solved with fsolve.

 

Digits:= 10:

eq:= a^l - Int(((0.6*r^2+1)^b/(0.375*r^2+1)^c)^l*r, r= 0..1);

a^l = Int(((.6*r^2+1)^b/(.375*r^2+1)^c)^l*r, r = 0 .. 1)

(1)

Subs:= convert([a= 1.003225155, b= 1.813666667, c= 2.666666667], rational);

[a = 163930/163403, b = 5441/3000, c = 8/3]

(2)

fsolve(eval(eq, Subs), l);

-1776.534864

(3)

Check residual.

evalf(eval(eq, [Subs, l= %]));

-0.1e-11

(4)

 

 

Download fsolve_int.mw

At the end of the computation in Part1, include the commands

try FileTools:-Remove("MyFile.m") catch: end try;
save var1, var2, var3, "MyFile.m";

where var1, var2, var3 are the actual variable names that you want to pass, and there can be any number of them. Make sure that the filename ends with the characters .m. Start Part2 with the command

read "MyFile.m";

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