787 Reputation

11 Badges

9 years, 200 days

MaplePrimes Activity

These are replies submitted by sand15

Maybe you should take a look at the "LinearFit" help page.
This procedure can return a lot of different ouputs, among them there could be what you are looking for.
If not, could you be more specific about your problem?

@Preben Alsholm 

(mmcdara from professional account)

Thanks for your reply, it will prove very useful in the future.
The only thing that makes me reluctant to use assuming instead of assume is that you must repeat "assuming ..." everywhere it's necessary.



Sorry to reply from the office with the login sand15.


Mistake ot not mistake ?
I would even say  mistakes.

You wrote "I simply looked at the graph the OP wanted to fit and "eyeballed" a few obvious points through which the graph passed."
As a rule it's already a very bad idea, specially when you already have numerical values at hand (the one the OP used).
Next, it's not your job, nor mine, not the job of anyone else to replace, as you did, data by one's own data. If you were suspicious about the OP's for they did not match the graph, you would have point this fact to him before giving adetailed answer.
And finally, what makes you so sure that the data you used after "eyeballed a few obvious points" are good: as you have probably noticed, the graph the OP gave does not mention the scales of the axis.

To end this, susceptibility is poor counselor.
You wrote "You seem to believe that the OP's selected points are important..." : NO, I just used your own words you used in your first answer "The overall strategy is to identify about six "important" points".
Please avoid rewritting the past



I would have payed more attention to your example.
Thanks for the details.



Agree, at first sight this seemed strange to me for the command 2.3 just returns 2.3 and not 6. I've always believed that the "dot" operator only meant "multiplication" in document mode or when used as a matrix product

But I just saw that `.`(2,6) in worksheet mode


It's strange you get Matrix(3, 3, {(1, 1) = -1, (1, 2) = -1, (1, 3) = -1, (2, 1) = -2, (2, 2) = -2, (2, 3) = -2, (3, 1) = -3, (3, 2) = -3, (3, 3) = -3}) with the command Matrix(3, 3, `-`);

In my case (Maple2018, worksheet mode) I get

Matrix(%id = 18446746664292233078), just as with Matrix(3, 3, (i,j) -> i-j);


The result returned by  Matrix(3, 3, `.`); is very curious, would you have any idea about it?

@Carl Love 

Right Carl, good point (beta distribution) and nice work (the completely formal solution).

It would be interesting to try to generalize this formal derivation to non uniform pdf.

For some of them order distribution are known and I think it could be possible to obtain interesting results.

By the way, my last mistake was that I write Ecost as a sum of two terms invoking the integral of Q-x as I should have written that it was defined as the value work Wich these two integrals are equal.

I think it would be better to avoid integrating Q-x between a and Q and x-Q between Q and b: fundamentally this is the same loss function Q-x (or x-Q) that we use.


Hope it's clear, I send this from my smartphone


@cinderella look to my code and your code.

The only difference is the expression of N. I define N as the integral of Q-x against the measure f, as you define  this same N as the integral of x-Q against the measure f.

If you are sure of what you did change the sign of N in my code.

You can do this in the 'numerical' code l sent you yesterday or in the formal code I sent you nine hours ago (in this matter change the sign of MAX in the expression of Qstar) 

I have no doubt you will be capable to fix this by yourself. Now I'm in weekend, see you in two days if necessary.


Then you can use this
reference : Maple V, release 5, Monagan et al, 1996  page 55

uniform := proc(r::constant..constant)
  local intrange, f:
  intrange := map(x -> round(x*10^Digits), evalf(r) ):
  f := rand(intrange)
  (evalf @ eval(f)) / 10^Digits)
end proc:

# usage

N := 100:
U := uniform(1..N):
s := [seq(U(), n=1..N)]:
t := sort(s, output=permutation)


This is indeed a fine way to address the problem.
Personally, despite an intensive use of the Statistics package, I'd never payed attention to this EmpiricalDistribution feature.
Maybe you have given a definitive answer to the question, I'm interested in reading acer's opinion on this point.




(mmcdara from my workplace)

"that integration is (for this kind of example) an alternative" : right, is an adhoc alternative limited to this special case of a function of 2 dice.

"But the full set of inputs -- to be passed to g -- is still produced with the nested seq. (The RVs assigned to Dice1 and Dice2 are not used.)"  : I assume you're referring to this instruction?

outcomes := [ { seq(seq(g(u,v), u in [$1..6]), v in [$1..6]) }[] ];

Right again, the whole construction I did is a liittle bit artificial and very specific to the problem.

More if this I think it would be better to be able to compute the probability for every integer values between -4 and 4 included.


Je ne suis pas certain que demander à ce qu'on vous fasse vos TD/TP de licence ou d'école d'ingé soit une bonne manière de vous faire apprendre Maple ?
Vous auriez pu, au moins ne pas reproduire mot à mot le sujet de ce TP.

I'm not sure that asking for someone to do your master's or  engineering school's tutorials (or practical work) is a good way to get you to learn Maple?
You could have at least not reproduced word for word the subject of your practical work..

As a starting point, for question Aa:
First of all you need a stopping criterion, for instance a measure of the difference between the exact value (if known) and its iterated approximations x[n], or the difference between x[n] and x[n-1].
Here is an example :

babylon := proc(x0, k, epsilon)
  local x:
  x := copy(x0):
  while abs(x^2-k) > epsilon do
    x := (x+k/x)/2
  end do:
  return x;
end proc:

# usage
babylon(2, 1, 0.001)


For point Ab: search list, or vector, or Array, ... in the help pages

For point B: search "thisproc" in the help page and take inspiration from the recursive calculus of the factorial of an integer


Of course!

I'm stupid, I didn't even think to use Sample~ !!!

Thanks Tom


Just read the help pages about Grid:-Launch.
You will find an example (primetest) that  I've just transposed to your test case.

Unfortunately I can give you detailed explanations, beyond that of saying "respect the content of the help pages".
If you are interesting in knowing why you must write babyGrid := proc() instead of babyGrid := proc(X) and later Grid:-Launch(babyGrid, imports=['X']) instead of Grid:-Launch(babyGrid, X), I'm not qualified to answer.

All you have to do is wait for someone else to give you this information.

@Carl Love  @tomleslie


Before sending my answer to Erik, I had tried to sample a function of two RV with values in R^2 (typically the "f" function used by Tom).

Remember I used RandomVariables Dice 1 and Dice2.
So I wrote, in a natural way,  f := (Dice1, Dice2) -> [Dice1, Dice2] and Sample(f(Dice1, Dice2), N).
As it generated an error, I tried to lure Maple by writting instead  f := (Dice1, Dice2) -> Dice1+I*Dice2
... which generated the same error as before.

All of this seems related to the impossibility (?) to define a multivariate random variable.
Am I right ?
Is it possible (without sampling independantly Dice1 and Dice 2 as Tom did) to define multivariate RV in Maple?

First 11 12 13 14 15 16 17 Last Page 13 of 25