Carl Love

Carl Love

28155 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Christopher2222 When you use the transparency option with a plot command, it is applied to the whole plot. The help page ?plot,options is incorrect where it says "This option specifies the transparency of the plot surface," [emphasis added] because it's applied to the curves also. But when you use filled, the transparency is only set for the shaded region, not the bordering curve, and the value used is 0.4. This is exactly what my code does.

@billyp245 The original equation is degree three in a, so it has three solutions. Only one is real. The real solution can be selected automatically if you wish.

In order to diagnose the problem of it not evaluating the a, I'll need the actual worksheet, which you can easily upload here.

On the other hand, the following code works:

E:= a-> a*h^2/2/m + 1/sqrt(2*Pi*a):
Sol:= solve(D(E)(a), a):
amin:= remove(has, [Sol], I)[]:
simplify(E(amin));

The trivial solution g(x)=0, s(x)=0 (for all x) is a solution to your system for any omega.

@acer So, if we make a dumb intermediate procedure that converts a module to a name, then it works:

ModuleToName:= proc(M::`module`) local N:= M; evaln(N) end proc:
MyPDF:= v-> t-> piecewise(t<0, 0, t<v, 1/v):

Statistics:-Mean(ModuleToName(Statistics:-Distribution(PDF= MyPDF(1))));

@Kitonum My solution (below) attempts to retain all the options from the original plot.

@vv This doesn't address the main issue: that the intermediate assignment to myD is necessary. The curry isn't doing anything special here. We still have that

myPDF := (v,t) -> piecewise(t < 0, 0, t < v, 1/v, 0):
Statistics:-Mean(Statistics:-Distribution(PDF = curry(myPDF, 1)));

produces the error.

@MortenZdk It doesn't work because fsolve requires a numeric x.

@adrian5213 

You need to compensate for the extra square brackets that you added in the previous step. So the next step should be Do(C= table(HD)) instead of Do(C= table([HD])). However, I'll defer to Acer on this point, if he has anything more to say.

@Markiyan Hirnyk 

A:= Array((1..3)$3,  (i,j,k)-> x[i,j,k]);

would be a more-appropriate analog to the symbol option of Matrix and Vector.

@tomleslie The OP was probably trying

plot(Prev(p), p= 0..1);

@Joe Riel Markiyan is referring to the Active Conversations menu. It gives only the title lines.

@MortenZdk You have 10 reputation points now. Also, it doesn't require any reputation points to select an Answer as the Best Answer.

Here's how to get the delta in your matrix in the context of your code. In the code below, note carefully how I changed the first D to d in each equation. And note that I changed solve to eliminate. In the final eval, I added another outer eval to change the ds back to Ds.

> 

restart:

> 

derivation := proc(A::Array)
local
     i, j, k, m, s, D, d, delta,
     n:= op([2,2,2], A),
     _D:= Matrix((n,n), symbol= D),
     _d:= Matrix((n,n), symbol= d),
     sols:= [eliminate(
          {seq(
               seq(seq(add(A[k,j,m]*d[k,i]+delta*A[i,k,m]*D[k,j], k= 1..n), m= 1..n), j= 1..n),
               i= 1..n
          )},
          indets(_d)
     )]
;
     userinfo(1, ':-sols', NoName, print('sols'= sols));
     seq(eval(eval(_d, s[1]), convert(_d=~ _D, set)), s= sols)
end proc:

AS1:= Array(((1..2)$3), {(1,1,2)= 1}):
infolevel[sols]:= 1:
derivation(AS1);

sols = [[{d[1, 1] = -delta*D[1, 1], d[1, 2] = 0, d[2, 1] = d[2, 1], d[2, 2] = d[2, 2]}, {delta*D[1, 2]}]]

Matrix([[-delta*D[1, 1], 0], [D[2, 1], D[2, 2]]])

> 

 

Download derivation.mw

Now this may still not be what you want because you want D[2,1] to be 0.

@farahamirah Just enter it:

A:= <-delta*D11, 0; 0, D22>;

@mskalsi Here's one that works on both forms

Delta:= e->
     if e::algebraic then diff(e,y,x,x) + diff(e,y,x) + diff(e,y,z,z) + diff(e,x,x) + diff(e,z,x,x)
     else (D[2,1,1] + D[2,1] + D[2,3,3] + D[1,1] + D[3,1,1])(e)
     end
if
:

Note that the D form relies on the positions of the function's parameters. It does not care whether you use x, y, or z. On the other hand, diff relies on the names being x, y, z and doesn't care about their order (they don't even have an order).

First 423 424 425 426 427 428 429 Last Page 425 of 711