Carl Love

Carl Love

28015 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Vini Your new Question, which I just deleted twice, is too close to this Question. Please discuss the matter in this thread.

At this point, I don't see any mathematical difference whatsoever in the two Questions; so, please try to say more precisely what you think the difference is.   

@Carl Love The above can be improved a little. I don't like that the 17 bars are crammed into interval 0..16. The interval should be -0.5..16.5. The improvement is a command called tallyinto.

B:= 16:
plots[display]([
    stats[statplots, histogram](
        stats[transform, tallyinto](
            map(`+`@op@convert, [$0..2^B-1], base, 2),
            [seq](k-1/2..k+1/2, k= 0..B)
        ),
        area= 2^B, color= pink, thickness= 0
    ),        
    plot(binomial(B,x), x= 0..B, color= blue, thickness= 2)
]);

@logan35 Oh my, Maple 7. That's a shame. In general, it's going to be difficult for you to get usable answers here on MaplePrimes. Very few of us have versions that old (about 20 years). Luckily, I've been using Maple long enough to have some memory of the old commands. So, try this:

plots[display]([
    stats[statplots, histogram](
        map(`+`@op@convert, [$0..2^16-1], base, 2), 
        area= 2^16, numbars= 17, color= pink
    ),        
    plot(binomial(16,x), x= 0..16, color= blue, thickness= 3)
]);

 

@logan35 The entire program is simply the one line that I gave:

Statistics:-Histogram((`+`@op@Bits:-Split)~([$0..2^16]), binwidth= 1);

@Teep Sorry, that was my fault. Try again; I just edited the code.

@acer Here is the OP's original attached worksheet:
 

VectorCalculus[Nabla] := 5

Error, attempting to assign to `VectorCalculus:-Nabla` which is protected

 

Delta := k

k

(1)

y := c+Delta

c+k

(2)

c := 2

2

(3)

"y:="

Error, invalid assignment

"y:="

 

y

2+k

(4)

restart

R := 1511.6

1511.6

(5)

t := 25.4

25.4

(6)

Rrt := R/t

59.51181102

(7)

E := 200*10^9

200000000000

(8)

nu := .29

.29

(9)

Ea := E/(-nu^2+1)

0.2183644503e12

(10)

F := 221*10^6

221000000

(11)

eq1 := sqrt((9*PI^2/(4*beta^2)-1)*(PI-alpha+beta*(sin(alpha)/sin(beta))^2)/(12*(sin(alpha)/sin(beta))^3*(alpha-0.4e-3*PI-beta(sin(alpha)/sin(beta))*(1+(1/4)*tan(alpha-beta)^2))))-Rrt = 0

(1/6)*3^(1/2)*(((9/4)*PI^2/beta^2-1)*(PI-alpha+beta*sin(alpha)^2/sin(beta)^2)*sin(beta)^3/(sin(alpha)^3*(alpha-0.4e-3*PI-beta(sin(alpha)/sin(beta))*(1+(1/4)*tan(alpha-beta)^2))))^(1/2)-59.51181102 = 0

(12)

eq2 := (9*PI^2/(4*beta^2)-1)/(sin(alpha)/sin(beta))^3-12*P*Rrt^3/Ea = 0

((9/4)*PI^2/beta^2-1)*sin(beta)^3/sin(alpha)^3-0.1158267336e-4*P = 0

(13)

eq3 := 1000*((1-sin(beta)/sin(alpha))/(2*Rrt)+P*Rrt*sin(alpha)/(Ea*sin(beta))+12*P*Rrt^2*beta*sin(alpha)^2*tan(alpha-beta)/(3*PI*Ea*sin(beta)^2)-F/Ea) = 0

7.389624070-8.401693570*sin(beta)/sin(alpha)+0.2725343385e-6*P*sin(alpha)/sin(beta)+0.6487604820e-4*P*beta*sin(alpha)^2*tan(alpha-beta)/(PI*sin(beta)^2) = 0

(14)

PI := 3.1415

3.1415

(15)

solve({eq1, eq2, eq3})

``


 

Download critical_pressure_calculation.mw

@madhav123 I wasn't suggesting that the solutions were non-real. I said "You can ignore the imaginary parts" because they are truly 0, and the solutions are truly real. The imaginary parts are just decimal rounding errors essentially past the 20th decimal place.

However, I have found a typo in your coding of the equations, which was the cause of your troubles. See my 2nd Answer.

@ContrapuntoBrowniano You wrote:

  • Both "add" commands need two arguments (maybe it's my version, Maplesoft 18)!

Yes, it's a version issue; the ability to call addseq, and mul with one argument (that argument usually being a "container" (set, list, array, etc.)) was added after Maple 18. As you've probably figured out by now, add(A) is equivalent  to add(x, x= A) in older versions.

  • i tried "add(x[ ],x=S)" and i got a more satisfactory answer, though.

That will only work if all the sets in S have the same number of elements. But this will work in your version regardless of sizes:

`+`(seq(x[], x= S))

@Preben Alsholm Note that the in the help-page passage that you quoted is defined earlier on that page: It's the sum of the squared residuals. So, for the case at hand, SolveEquations is finding minima of (cos(x) - 0.001*x^2)^2, and the first column of the returned matrix is that expression evaluated at the given in the third column.

@Shashwata Chowdhury Thank you. I coded the above so that L3 could be created from L1 and L2. The only good reason to do it that way is if L1 and L2 are going to be used later. If, on the other hand, L1 and L2 are only being used as building blocks for L3, then it's easier to not create them at all. Rather create L3 directly as

L3:= [seq]([seq](seq1[j]+i, j= 1..7), i= 0..23);

@Christian Wolinski Your closed-form solution procedure can be simplified (by my hand, not by Maple) to

G:= n-> (3*I^n*<-3,1;5,0>.<I,-I;1,1>.<1,-1>^~n + <-2,2>)/2/n!;

And it can be used as 

G~([$0..10]);

How did you get your solution? I couldn't get it with rsolve.
 

@Kitonum Using Maple 2019, I copy and pasted your code without making any changes. The results of the solve and subs that I got are exactly as you show. However, my results for the seq are

[2, 1], [8, -14], [-2, 1/2], [-5/3, 8/3], [1/12, 1/24], [1/15, -7/60]

I also solved the problem by a different method and got those same values.

@pik1432 You seem to have a fundamental misunderstanding of the intended purpose of diffop2de. You need to use the differential operator that has been declared. In your example #1 above, you've declared Dt as the operator and t as its variable. But your equation doesn't contain Dt, so nothing special happens when you call diffop2de. In example #2, no differential operator has been declared, so you get an error. In #3, you've declared Dx and x but the equation doesn't have Dx; it doesn't even have x.

The command diffop2de does NOT take derivatives of overall expressions, so it won't turn constants to 0. Rather, it applies the special differential operators already present in the expression. It is possible to use D as the special differential operator if you declare it so, but I strongly advise you to not do this unless you have a complete understanding of what the command does.

@dharr I came up with a better solution to the is problem. I too am reluctant to use the "big gun" of highly symbolic is when it's not needed for most practical cases. The solution is to use `<=` as the default order evaluator and allow the user to pass in another if it's needed (just like one does with the sort command). 

unimodal:= proc(L::list, `&<`:= `<=`)
local n:= nops(L), k;
    for k to n-1 while L[k] &< L[k+1] do od;
    for k from k to n-1 while L[k+1] &< L[k] do od;
    evalb(k=n) #i.e., Did we get to the end?
end proc
:
unimodal([1,Pi,1]);
Error, (in unimodal) cannot determine if this expression is
true or false: 1 <= Pi

unimodal([1,Pi,1], is@`<=`);
                              true
unimodal([3,1,3], `>=`);
                              true

This change makes the procedure shorter, and now any list can be accepted.

@Scot Gould Yes, of course, a comment symbol is never "necessary" when there's no comment. It's traditional in many languages to make boxes and another visual delimiters with them. I was finishing the vertical line of semicolons.  

First 92 93 94 95 96 97 98 Last Page 94 of 708