Questions tagged [design-patterns]

The tag has no usage guidance.

22 questions
80 views

Fourier Transform of a symbolic expression

Hello I would like to do the Fourier Transform of H1'[t - L2[t]/c - L2primo[t]/c] I know that its transform has to be: ...
105 views

Is there a way to make $g$ changeable independently of $f$ in this code?

My problem is that in the below code, every time I want to change $g$ I also have to change $f$. Let's say we have three functions: $f$, $h$, and $g$ ($h$ is not really relevant for the question, but ...
1k views

Permanently extending the behaviour of functions (like decorators)

Suppose I have a function, e.g. f[x_] := x^2 It works like this: f (* 25 *) I would like to permanently modify it so ...
698 views

How and why to use monadic programming in Mathematica?

This is a methodological question with two parts: How to use monadic programming in Mathematica? Why use monadic programming in Mathematica? In my opinion the questions are inter-related -- we ...
74 views

Designing a Manipulate Block

I am trying to create a Manipulate block which contains tabels, graphs and explanations. In the first row I want to add some tables and explanations, but sometimes the tabels are cut. For doing this I ...
445 views

Draw Graph with upper and lower limit

I am attempting to draw a graph with a slope of 200,000 that becomes "saturated" at $y= \pm 10$. Essentially, the graph is of the form $y=200000x$. However, I have been unsuccessful in getting it to ...
86 views

Does Mathematica have a method for achieving the same goals that Aspect Oriented Programming does?

I imagine that this question has been asked before, yet I'm not able to find an answer using the form of the question I believe might be asked. Is there a mechanism for duplicating the ...
201 views

Longest and Shortest won't work in ReplaceList?

I'm trying to make a pattern that's easy to preceive by human but hard to write out by Mathematica when I came across this problem. (Check the original problem here) Let's check this simple case: I'...
544 views

Opposite of Alternatives

I was looking at this question (here) and I tried to find any thing gives the opposite of Alternatives. In other words, some pattern matching function that gives ...
34 views

Design problem with an an InterpolatingFunction-like object: bad performance over a remote kernel

I these last times, I found myself using often the following approach. Given some data, I make some preliminary, common, computations and I store these results in an ...
650 views

How to add texture to a parametric plot?

I need to put some simple textures to some parametric plots. My textures are not complicated, They are like the first example in here. Is there any simple way of doing this? For example, How can I ...
55 views

How to correctly use PatternTest (?) [duplicate]

This works fine: {3, -5, 2, 7, -6, 3} /. x_ /; x < 0 :> 0 (*{3, 0, 2, 7, 0, 3}*) and this works fine: ...
288 views

Implement settable properties

I am looking for advice on implementing the following. (It is possible that the answer is that it is simply not a good idea to do this.) I would like to have an object similar to ...
444 views

Why does MapIndexed return the index in a list?

MapIndex returns the index in a list instead of as shown in my revised example. I can work with it (or work around it), but what's the design concept? It seems ...
7k views

Can one identify the design patterns of Mathematica?

... or are they unnecessary in such a high-level language? I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
772 views

What's the analogue of UML in Mathematica land?

What's the analogue of Unified Modeling Language (UML) in Mathematica land? Mathematica has elements of object-orientation, but most Mathematica programs or applications aren't of object-oriented ...
415 views

Do “objects” in Mathematica have to be declared?

A while ago I learned a trick which allows one to imitate object-oriented programming in MMA using SubValues: ...
2k views

The basic problem I have been running into is making readable code, where in other languages I am more familiar with I might have been using class or struct like objects. For example, you can imagine ...
6k views

How can I implement object oriented programming in Mathematica?

Roman Maeder's object oriented programming package is nice, but I'm hoping someone can suggest a sleek and novel implementation that is easy to use.
10k views

What does the construct f[x_] := f[x] = … mean?

This question mentions "x := x = trickery". What does defining a function as f[x_] := f[x] = ... do and what is it good for?