All Questions
15 questions
1
vote
0
answers
104
views
How to use the tedious definitional results to make a next definition for FindRoot?
I am trying to use a designed function to find the quasi-normal modes.
...
1
vote
1
answer
98
views
generate quadratic functions to evaluate membership of points
How can I make a printable list with different quadratic functions and with points that belong or not to them so that a young person can check whether or not the point belongs to the parabola? my code ...
4
votes
1
answer
108
views
Best way to write a function that randomly takes definition from list of functions?
I want to define a function based on a random choice from a list of possible functions.
For example, suppose the possible functions are {Sqrt,Log}. Then I want to ...
2
votes
3
answers
110
views
Strange Behavior of Compile[] inside With[]
Consider, in the examples below, the difference between defining $n$ as a global variable or as an argument to function comp[], which includes a compiled function ...
1
vote
1
answer
56
views
Function and patterns. FixedPointList doesn't work with function [closed]
There is a function:
Clear[sort]; sort[{a___, b_, c_, d___}] := {a, c, b, d} /; b > c;
It perfectly works with NestList function:
...
19
votes
2
answers
629
views
Improving Performance of an XY Monte Carlo
I normally write my Monte Carlo codes in Fortran for speed, but I was doing some quick and dirty work and wrote one in Mathematica for the XY model on a square lattice (see Kosterlitz-Thouless ...
3
votes
2
answers
151
views
Function with string explanation for its arguments with equal signs [duplicate]
I want to write a function using string as explanation for its arguments so that the function becomes intuitive for new users. For example, I want to write a function to compute BMI (just for ...
2
votes
1
answer
207
views
Define a function with specific permutation properties
I want to define a function evaluate[f_[x__]] which acts on an arbitrary function f[a,b,c,d]. The function ...
4
votes
3
answers
2k
views
Recursion - Concentric Circles
I'm trying to develop my Wolfram programming skills and set myself an exercise of creating concentric circles using a recursive delayed function:
...
4
votes
1
answer
203
views
How can you get the area of a region from an image?
Suppose we have a square of side "L" m,
How can I calculate the hatched area, if the corners of the square are centers of circles.
It can be generalized to any region?
edit:
This is the result I ...
6
votes
4
answers
678
views
Expressions containing globally undefined symbols inside a function where they are defined
Consider the following code.
f[a_,b_]:=x
x=a+b;
f[1,2]
(* a + b *)
From a certain viewpoint, one might expect it to return 3 ...
3
votes
1
answer
867
views
How can I call the R-programming packages in my Mathematica?
I am trying to call the R-programming package called highfrequency in my Mathematica so that I can use its function rCov. I ...
0
votes
1
answer
273
views
A problem with set values
The following code is just an example to clearly explain my problem.
Assume that :
...
0
votes
1
answer
149
views
How to put some values from a list into a function in a Do loop
I want to program a code in MATHEMATICA in order to calculate some values in different iteration. For example, assume this list:
list={1,2,3,4,5}
Now assume that ...
9
votes
3
answers
605
views
How to exit from the innermost enclosing pure function?
Here is what I tried to do:
Scan[Function[x,
Scan[Function[y,
If[y == 2, Return[]];
(* Do something useful *) Print[y]],
x]],
{{1, 2, 3}, {4, 5, 6}}]
...