Questions tagged [function-construction]

For questions on writing functions (pure or using Set/SetDelayed) for any purpose, including the features that may be incorporated in those functions, such as options, patterns and conditions.

2,128 questions
Filter by
Sorted by
Tagged with
33 views

How to specify specific (custom) function arguments

Suppose that I want to have a function that is evaluated only when a user-specific, predefined flag is given out of a list of possible flags. For example ...
148 views

How to find the function range of this?

How can I function range of the function x/(-1 + 2 x) over the domain (0 <= x<= 1)? I tried this but ...
70 views

How to create nice looking circuit from its connection information?

I'm trying to write code to create a circuit from its connection information. For example, in the image below you see an incompleted circuit with two batteries, one resistor and one capacitor. The ...
57 views

How to define specify parameter functions of a Sturm-Liouville operator & plot its effect on specific functions?

I have a Sturm-Liouville operator: $$\mathcal{Ly(x)}=-\frac{\mathrm{d}}{\mathrm{d}x}\left(p(x)\frac{\mathrm{d}}{\mathrm{d}x}y(x)\right)-q(x)y(x)$$ but I do not yet know the parameter functions $p(x)$ ...
30 views

30 views

Suppressing tensor indices and function labels of a function

I am trying to do some GR calculations, and want to write a code which shows the expressions symbolically using compact indices, rather than write all the quantities in detail. More precisely, ...
49 views

Why is Style ignored in my custom Echo error function?

To highlight the type of error that occurred the function echoError (via err) should display type of error in color: ...
223 views

Using Mathematica to derive analytic form of single variable function

I am interested in finding an analytical form of the following function $f(n)$ defined as: $$f(n):=\sum_{\{\bar{K}\}}\prod_{l<j}^{n}e^{ik_lk_j},$$ where $\{\bar{K}\}$ is the full set of binary ...
70 views

Defining function with arguments in a specific pattern similar to Graphics[]

I'm trying to define a function that is of this form: ...
200 views

How to set deeper patterns in arguments within function definitions. For example if an argument must be a list of 1 or more strings

Suppose I want to define a function whose argument must be a List of only Strings and List must have at least one member. I know how to require that the Head must be a List but how does one qualify ...
66 views

Integrate of simple equation but is not solving!

I have this simple integral but I don't know why Mathematica can't solve it?! FullSimplify[Integrate[x/(-x^2 + a x + b)^(1/2), {x, Sqrt[b], Sqrt[R^2 + b]},Assumptions -> {a > 0, b > 0}]]