Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@rhcp In the case that there is a conflict between these options, do you want the piecewise sorted ascending with respect to q*, descending with respect to z, or something else? The standard way in Maple is ascending with respect to z with the lower bounds not explicitly stated, though it's easy to present in an other-than-standard format. And do you want the piecewise presented in terms of w/p or z?

@rhcp You'll need to upload and post your worksheet because what you've shown in your Question is too small for me to read, even at the maximum magnification.

@tomleslie As types, radical and anything^fraction are equivalent, and radical is more to the point; so, vote up.

Here are a few corrections, including returning 1 if the probability of the condition is 0 and returning FAIL if the unsimplified results from Probability give FAIL/FAIL.

Conditioned:= proc(
   event::{relation, set(relation)},
   cond::{relation, set(relation)}, 
   rv::
      {name= RandomVariable &under Statistics:-RandomVariable,
       {set,list}(name= RandomVariable &under Statistics:-RandomVariable)
      }
) 
uses St= Statistics;
local 
   Event:= `if`(not event::set, {event}, event),
   Cond:= `if`(not cond::set, {cond}, cond),
   RV:= `if`(not rv::{set,list}, [rv], [rv[]]),
   d 
;
   if nargs=3 then 
      (Event,Cond):= 
         subs(lhs~(RV)=~ St:-RandomVariable~(rhs~(RV)), [Event, Cond])[]
   fi;
   d:= St:-Probability(Cond);
   if d = 0 then 1
   elif d = FAIL then FAIL
   #union used rather than intersection because Probability considers a set
   #of relations to represent the intersection of the corresponding events. 
   else St:-Probability(Event union Cond) / d
   fi
end proc:

Probability cannot handle the multivariable situations that you want to consider. If you're only interested in spaces that are the product independent uniform distributions, I may be able to code something from scratch.

@BigBugBuzz I haven't seen any mention of an actual bug in Probability in this thread, just limitations. If presented with a problem too complex, it may return the symbol FAIL. Some of the more-complex problems may be easily done by numeric integration if an exact answer is not required. Do you require exact solutions?

@inteli 

You can select columns 3 and 6, for example, by M1B[.., [3,6]]. You can select rows 5 and 1, with 5 being on top, by M1B[[5,1], ..].

@Markiyan Hirnyk 

I am in Amsterdam, many thousands of kilometers from my home. I will fix the FAIL issues when I have access to a computer, which is likely Friday. I need a different power adapter for my computer due to the different electricity here, I've ordered it, and it's coming Friday.

I already said that FAIL/FAIL incorrectly simplifies to 1 and that I'd fix it when I had access to a computer. That you would mention it again in just a few hours is what we call "flogging a dead horse."

@Markiyan Hirnyk The error comes from Probability, not from my procedure. Would you expect me to rewrite that also? The Mathematica conditioning operator is just an add-on to its probability command. Likewise, my procedure is an add-on to Probability. It does correctly handle whatever multivariable cases Probability handles.

The situation is far from ideal, but you can't blame me for the longstanding deficiencies of Probability.

When I have access to a computer, rather than my phone, I will correct the case where FAIL/FAIL simplifies to 1.

@Markiyan Hirnyk 

I don't have Mathematica, so I can't check which cases it handles; so, I made it at least robust enough to handle the single example given in the Question.

My procedure (as originally posted) handles the multivariable case when the random variables have already been declared. To handle the other case---that the variables are being declared directly in the third argument (similar to an assuming clause), requires only a trivial modification:

Conditioned:= proc(
   event::{relation, set(relation)},
   cond::{relation, set(relation)}, 
   rv::
      {name= RandomVariable &under Statistics:-RandomVariable,
       {set,list}(name= RandomVariable &under Statistics:-RandomVariable)
      }
) 
uses St= Statistics;
local 
   Event:= `if`(not event::set, {event}, event),
   Cond:= `if`(not cond::set, {cond}, event),
   RV:= `if`(not rv::{set,list}, [rv], [rv[]]) 
;
   if nargs=3 then 
      (Event,Cond):= 
         subs(lhs~(RV)=~ St:-RandomVariable~(rhs~(RV)), [Event, Cond])[]
   fi;
   #union used rather than intersection because Probability considers a set
   #of relations the represent the intersection of the corresponding events. 
   St:-Probability(Event union Cond)/St:-Probability(Cond)
end proc:

 

@BigBugBuzz I think that it'd be best to avoid applying evalf to expressions containing RootOf because it'll generally only give you one result when there are many. Rather, you need to isolate roots to intervals, possibly complex intervals.
            

@tomleslie I think that you intended to include an argument w = 0..1 to your fsolve, but that you forgot it.

 

@ibndirac Sorry, I misterpretted something---not something that you wrote but some Maple output. My Dirac comment was totally irrelevant.

I suppose that you think of diff(g(x,t), x) as some sort of Dirac-like function, right?

@Annonymouse The dimension of a solution returned by solve is the number of its vacuous equations.

@brian bovril Change the declaration for Games in procedure Update to

Games::list({
      [{name,string}, {name,string}],
      [{name,string}, {name,string}, anything]
   }),

And change the updating line to

(R[G[1]], R[G[2]]):= ELO(R[G[1]], R[G[2]], G[3..][])

By the way, Elo is not an initialism or acronym. It's named after the person who invented it, Arpad Elo. So it'd be more proper to spell it Elo rather than ELO.

First 321 322 323 324 325 326 327 Last Page 323 of 709