Carl Love

## 26877 Reputation

11 years, 305 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

## No attached file...

There was no file attached to your post.

I couldn't read the screen, but I linked to the GIF file. That problem/bug looks very weird. It looks like the Matrix returned by MatrixAdd has memory overlapping with another Matrix. Could you upload the entire worksheet so that we can investigate further?

Also, what do you get from the simple M+K?

## Your example shows matching...

But your example, in the red ellipse, does show yellow rectangles around the matching brackets. Can you show the example where it does not work?

## So, did you intend uniform?...

@Markiyan Hirnyk So, as I continue to work on the original problem, I'd like to know if you intended a uniform distribution? Sorry if that wasn't clear from my last post. It doesn't really change the problem, but the average computational effort required will be different for many algorithms. I'd guess that an algorithm tailored to the logarithmic distribution would have a much better average time when the intervals were drawn from that distribution.

I'm working on a O(n~ +  h) algorithm, where n is the number of intervals and h is the number of pairs of intervals that "hook" together.

## logarithmic distribution intended?...

Note that the default for RandomTools:-Generate(float(range= a..b)) is a logarithmic distribution. If one of the endpoints is 0, then there is an extreme bias towards values close to 0. I don't think that that is what you intended. You can override the default thus: RandomTools:-Generate(float(range= a..b, method= uniform)). See ?RandomTools,flavor,float.

## 1/I = -I...

@kswong89 The minus sign in front is because 1/I = -I, assuming that by I you meant sqrt(-1), which is the default in Maple. If you just meant for I to be a variable, then we need to change that default, which is not difficult to do.

## 1/I = -I...

@kswong89 The minus sign in front is because 1/I = -I, assuming that by I you meant sqrt(-1), which is the default in Maple. If you just meant for I to be a variable, then we need to change that default, which is not difficult to do.

## How does it differ?...

@Karla How does Markiyan's solution differ from what you "would like to have as an answer"?

## How does it differ?...

@Karla How does Markiyan's solution differ from what you "would like to have as an answer"?

## side note on trivial Flattenings...

This is not a comment on the piecewise aspect of the question. I just want to point out that the trivial type of list flattening done in Adri's answer can be accomplished much more simply by appending [] (empty square brackets). Also, the digits=2 needs to be inside the parentheses of float(...) in order to be effective. With these changes, Adri's code becomes

`N := 5:Y := [seq( randpoly(x,degree=2), i=1..N )]:X := sort( [seq(RandomTools:-Generate(float(range=1..10.0, digits=2)), i=1..N)] ):H := seq( [x<=X[i],Y[i]][], i=1..N ):yp := piecewise( x<=0, 0, H, 0 );`

## side note on trivial Flattenings...

This is not a comment on the piecewise aspect of the question. I just want to point out that the trivial type of list flattening done in Adri's answer can be accomplished much more simply by appending [] (empty square brackets). Also, the digits=2 needs to be inside the parentheses of float(...) in order to be effective. With these changes, Adri's code becomes

`N := 5:Y := [seq( randpoly(x,degree=2), i=1..N )]:X := sort( [seq(RandomTools:-Generate(float(range=1..10.0, digits=2)), i=1..N)] ):H := seq( [x<=X[i],Y[i]][], i=1..N ):yp := piecewise( x<=0, 0, H, 0 );`

## = not :=...

@kswong89 I wrote w(x,y) = .... You changed it to w(x,y):= ....

## = not :=...

@kswong89 I wrote w(x,y) = .... You changed it to w(x,y):= ....

## It has nothing to do with the a[0]...

@dhonkabulo I don't know why it doesn't work, but it has nothing to do with the a[0] or with the convert(a, `local`). The plot shows up on your screen, right? with the a[0], right? Your original question was how to get the a[0] on the plot, right?

Does saving the plot to postscript work without a[0], or with "a[0]", as you originally had it?

## It has nothing to do with the a[0]...

@dhonkabulo I don't know why it doesn't work, but it has nothing to do with the a[0] or with the convert(a, `local`). The plot shows up on your screen, right? with the a[0], right? Your original question was how to get the a[0] on the plot, right?

Does saving the plot to postscript work without a[0], or with "a[0]", as you originally had it?

 First 649 650 651 652 653 654 655 Last Page 651 of 693
﻿