Skip to main content

All 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. ...
Robert Xu's user avatar
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 ...
zeros's user avatar
  • 2,365
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 ...
user106860's user avatar
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 ...
Just Some Old Man's user avatar
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: ...
Rumato's user avatar
  • 727
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 ...
Kai's user avatar
  • 2,219
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 ...
ramesh's user avatar
  • 2,329
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 ...
apt45's user avatar
  • 1,688
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: ...
awyr_agored's user avatar
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 ...
Fernando Silva's user avatar
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 ...
imakhlin's user avatar
  • 177
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 ...
Eric's user avatar
  • 219
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 : ...
Shellp's user avatar
  • 523
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 ...
Shellp's user avatar
  • 523
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}}] ...
Vladimir Reshetnikov's user avatar