Mac Dude

1531 Reputation

17 Badges

11 years, 38 days

MaplePrimes Activity


These are replies submitted by Mac Dude

@ivanwolodin Well, if the sequence I wrote does what you need for one dimension then the extension to two dimensions is trivial: you just wrap a second seq around the first one:

seq(seq(evalf(b*cos(n*Pi/10)),n=0..20,0.1),b=-1..1,0.5);

I hope it is clear that the third argument to the seq() is the stepsize & you need to adjust that to your needs.

Seq() returns a sequence, a comma-separated series of values. Depending on what you do with the result you may need to cast the result as a list or something else, e.g. by applying the suitable delimiters ([] for a list, <> for a Vector). You will need to familiarize yourself with these data structures (RTFM).

It remains as an exercise for you to switch the order of the seq()'s if you need that.

M.D.

@acer Nice, had not thought about that.

M.D.

@acer @Rouben Rostamian ,

Thanks for your replies. Rouben's suggestion is something I shall look into more as it may be the right thing to do. Esp. as @acer indicates that I cannot get what I want using the assign mechanism as it will create  global variables (I did not know that).

Since @acer was looking for context I am attaching the code in which I wanted to use this assign contruct. Note that this is not a complete program, it is the early part of a package I want to write to read data files written in a so-called "SnP" format by some network analyzers (aka Touchstone format). So I write a module that has a proc "Read(filename)" to pull in the data. I eventually want to assign the read-in data to module-specific variables that I can access from the program using this package. (And yes, to do that my Sij actually need to be exports, but I wanted to debug this without having to unprotect all of these guys). Note that the code as attached does not work (yet) since I still need to work on the Read proc which I initially wrote outside of the module (and which does decode the file the way I want it to).

Once I have this part working routines for plotting & other stuff will be added as I have the need.

So, as I am typing this the merits of Rouben's suggestion appear even stronger since I only have the variable "S" to worry about. The fly in the ointment is that the caller (me) has to access the content like S[2,1][index] rather than S21[index], the latter being a more natural way. But I may be able to live with this. Or I can write 99 explicit variables; once I have them defined I assume I can set them using assign(), although now I am no longer sure about that. Note that when reading the files one would not usually have to bulk process all these vectors, often focusing on a small subset (like one or two).

Thanks much for your comments

M.D.

Touchstone.mw

It has changed, but I think it was earlier than Maple 2021. I think add and friends behave the same way now.

M.D.

I suggest you consult @dohashi's Parallel Programmimg Content page, with links to various posts of his.

M.D.

@acer Ok, so this looks definitely more involved than I expected. "passign()" appears to be undocumented so I don't know what exactly it is doing. The fact that Convolution() calls an external routine actually explains the rather quick execution of the routine on my actual data sets.

What I was looking into was whether I could modify the routine to be applicable to certain special cases I have (or rather I think I have) that look similar to a convolution but require modifying the scale of the independent variable ("X axis", if you will). Whatever I will end up doing, messing with the library function clearly won't be in the cards.

I did learn from your codesamples about the "opaquemodules" kernelopt; I was not aware of that before. It may be handy for other projects I am working on.

Thanks very much,

M.D.

 

@acer @Kitonum @mmcdara There is a wealth of info you posted & I can see how I will handle this. Have to deal with something else for hte next few days, but if I can distill all of this into a decent solution of some generality I'll post back.

Thanks very much all,

M.D.

@Kitonum Thanks much for looking at this. The first way does not work for me in Maple 2015; maybe it works in newer versions?

The second way works, and I think I can extend it to my production cases (what I showed was a minimum example). The only issue there is that I have a number of these, some of them show as (0.1200000+epsilon) rather than 0.12+epsilon. This makes a difference for subs(), but maybe I can figure how to regularize that.

Thanks,

M.D.

@tomleslie @dharr  Thanks both. I feel a bit stupid not realizing that plots:-pointplot does both cases ( a list of points and two lists, one being plotted against the other); it is even in its Help page.

With plot, the case of a list of points is not shown in the Help page.

Mac Dude

Since you assign an expression to Delta, you will never get a result containing Delta as Delta is replaced by the expression.

expand works. If you don't assign to Delta you end up with terms up to third order in Delta. How do you know that your desired result is indeed equal to your expression?

Why ExpandSteps fails I do not know.

M.D.

Show us the beginning of the file so we can see what it is.

M.D.

@mmcdara Something seems not right. 30 years of $4k per year is already $120k. In fact, per the manual, futurevalue is the fv of an amount, a one-time payment.

I do not find the future value of an annuity in the Finance package, although I assume it is there.

M.D.

@Jean-Claude Arbaut, @acer@vsubramanian

This is all well and good, but I was just wondering why on my system Maple's CUDA support just ignores my card and errors out. As I said in my o.p., I don't expect huge gains, but it should at least work.

M.D.

@Carl Love You are correct, my apologies for not being careful enough here. In fact, Maple appears to ignore parts of the whole expression silently due to these errors.

Fixing this up by assuming these are implied multiplications, solve no longer works and runs against a div by zero error in Engine:-ExpandRofs. fsolve comes up with two numeric solutions.

At this point the OP needs to look at this again and clarifies what this expression really is supposed to look like, since I am now way too far in speculation-land.

M.D.

 

@Joel19 Look at the file I uploaded in my answer. You still seem to have square brackets, and also you need to get rid of the "=0" at the end of your function. The way you wrote it it would return a boolean (true or false) as it evaluates the = operator.

M.D.

1 2 3 4 5 6 7 Last Page 2 of 42