Questions about the use of built-in Mathematica functions, including pure functions.

learn more… | top users | synonyms

0
votes
0answers
26 views

Why don't we use SetDelayed when we use placeholder to declare a function? [duplicate]

On the answer of http://stackoverflow.com/questions/4272067/what-does-mean-in-mathematica Typically when we declare f(x)=x^2 function, it is: f[x_] := x^2 But ...
0
votes
0answers
37 views

How can I put the results of TrigReduce function into a more convenient form? [duplicate]

a1 D11 Cos[n x] + a0 a1 D11 Cos[n x] + 1/2 a1 a3 D11 Cos[n x] + 1/2 a2 a4 D11 Cos[n x] .......for example this expression can be written like ('expression') * ...
2
votes
1answer
91 views

How to run code in a saved file when it is opened

I have a Mathematica file that I saved. In it, I have multiple functions that I've defined and have evaluated a number of the functions with different arguments. I would like to be able to open the ...
1
vote
1answer
58 views

Defining a Function

I've been reading about functions in Mathematica and playing with this for hours, but I'm clearly missing something. The following code correctly calculates "fail", the number of failed scenarios. I ...
-1
votes
0answers
19 views

My parametric plot isn't appearing [on hold]

I solved two differential equations of motion (x(t) and y(t)) for a projectile, but now need to plot the projectile for certain values. However, when I try to use Parametric Plot, the plot appears ...
-5
votes
1answer
57 views

How to use module for not knowing how variables is the function? [on hold]

Does somebody know how to write module in Wolfram Mathematica which will receive boolean function without knowing how variables it will have? Thanks.
-3
votes
0answers
32 views

Find an example of continuous but not increasing function whose inverse function doesn't satisfy the Inverse Theorem [closed]

I have to find an example of a function $f : [a, b] → R$ which is continuous, but not strictly increasing, such that no inverse function $f^{ −1}$ satisfy the property of the Inverse Theorem.
1
vote
1answer
82 views

Create a function with Dt[x] as a variable

I have a function (for example F[x_]:=Cos[x]). I want to define a function like Fdot[x_,xdot_]:=Dt[F[x]] where xdot represents Dt[x]. For example, to define Fdot one might naivley try ...
1
vote
0answers
25 views

Import names into notebook namespace

I have function that at some point has list of strings (e.g. {"apple","pear"}) and I want to declare (initialize) those variables in notebook namespace to default value (e.g. 0) so I could execute in ...
0
votes
0answers
36 views

About the derivation of vector [closed]

We know that the derivation of the function in the attached picture is aij. But how to use Mathematica to calculate this? I am new in Mathematica, thanks so much for your response!
0
votes
1answer
53 views

How can I use nonlinear model fit with multiple variables? [closed]

I have a data set with four entries. the first three entries correspond to variables in the fit x,y, & z. The fourth entry corresponds to the function value. I am trying to fit this data to a rate ...
2
votes
1answer
98 views

How do I download and export data from many weather stations?

I tried this code, which downloads data from several weather stations. ...
0
votes
1answer
47 views

How to properly use conditionals inside NDSolve

Currently I am working with Mathematica to learn the program, and I'm confused what exactly is wrong with this code. ...
0
votes
0answers
44 views

StringLength function [duplicate]

allWeatherStations = WeatherData[]; fullformStations = FullForm /@ allWeatherStations; Tally[StringLength /@ fullformStations[[All, 1, 2]]]. This code not working. ...
0
votes
1answer
46 views

Replace element of matrix based on rule which invloves other element of same matrix

I am trying to replace 1s row of matrix d iteratively from right by multiplying last element in 1st row with (1-int*dt) to generate 2nd last element. The replacement continues till I reach the 1st ...
0
votes
0answers
50 views

How to replace a part of array based on certain rules which involves usage of other array

I am trying to replace outermost column of array "fd" in below code. fd is matrix of dimension (nas1,nts) which is initially filled with 1. I want to replace outermost column of fd with result of Max ...
5
votes
2answers
190 views

How do I plot my country map with weather data stations?

I've tried this code, but I can't plot the coordinates in my country map. ...
4
votes
2answers
111 views

Coarse-graining in numerical integrations

I have been working recently in a coarse-graining problem I found when using NIntegrate: I am trying to evaluate the function $$f(a)=\int_0^{\infty}x\,e^{-(a^2+b^2)x^2}\text{d}x$$ numerically as a ...
1
vote
2answers
145 views

How can I create function which contains an ODE system and its numeric solution?

I have created a function like the following, which contains an ODE system. And I want to know the effect of different parameters. ...
2
votes
0answers
41 views

What is the difference between GenerateDocument and TemplateApply[NotebookTemplate[

Abstract GenerateDocument[ _NotebookObject ] seems to do the same what TemplateApply[ NotebookTemplate @ _NotebookObject ] ...
3
votes
1answer
153 views

How do I create an array by applying a function to the index of each element?

I am looking for something like matrix(m, n, f), but for Mathematica rather than MuPAD, and for arrays rather than matrices. That is, I'm looking for a(n ...
-1
votes
1answer
116 views

need help to price a european option using finite difference method [closed]

I am writing a function to price European option using backward induction finite difference method. The function is expected to price a European option taking Stock (stock_), age (time_), volatility ...
2
votes
0answers
43 views

Construct single InterpolatingFunction from a mathematical combination of other IF's

Let's say I have an interpolated function f, like I might get as the solution to an NDSolve: ...
0
votes
2answers
162 views

FindShortestTour to solve Traveling Salesman Problem

I'm trying to write my own code to find the shortest route but I'm lost on how or where to start. Does anyone have any idea how the FindShortestTour function works? What type of algorithm or structure ...
6
votes
2answers
77 views

Optional arguments with lists as function parameter

I'm developing a function f which should support optional arguments {x_, y_} in list form. A simple example looks like this: ...
0
votes
1answer
83 views

Can we say that “all functions in Mathematica are some kind of pattern-matching-and-replacement procedures”? [duplicate]

Currently I am studying Mathematica programming, and when I study pattern matching and replacement, I find it is quite similar to functions. So can we say "all functions in Mathematica are some kind ...
0
votes
1answer
38 views

How to have default case in Which? [closed]

Saying we have a function: a[x_] := Which[x === 1, "AAA", x === 2, "BBB", _, $Failed] How can I make this function to be equal to ...
1
vote
1answer
65 views

Why is the Spherical Bessel Function acting strangely at this point?

I'm doing some computation that requires the use of Spherical Bessel Functions of the 1st kind, at high orders and values. So, I managed to find this, while running it over a wide range of values. I ...
-1
votes
0answers
40 views

How can I define a function to make symbols? [duplicate]

I want to define a function that makes symbols like this: L[1] A1 L[2] ...
0
votes
1answer
71 views

Calculating a function repetitively without using a For loop

In my programme I have defined all these functions: ...
1
vote
1answer
66 views

How to Reap data from a ScheduledTask?

Here is an amusing little function mapped over a range just to iterate it. It ignores its argument and works entirely by side-effecting a global variable: ...
1
vote
0answers
73 views

How can I use L.Shifrin s code formatter package better

in the document of HoldAllComplete, it says: Evaluate cannot be used to override HoldAllComplete.. for example, when I'm ...
0
votes
1answer
60 views

Calculating functions of sounds

I've seen that it is possible to create a sound from functions: Sound[{Play[Sin[1000 t (1 + t^2)], {t, 0, .2}], Play[Sin[500 t (1 + t^3)], {t, 0, .5}]}] Is is ...
6
votes
2answers
66 views

Maximise output issue

When I execute the following command, I get a numerical output as follows: ...
1
vote
3answers
144 views

How to calculate time period?

I have the starting and ending dates and times. And I need to calculate the night time in this period (from 10 pm (22) to 6 am (6)). Example: starting date and time is {2015, 1, 4, 3, 10} ending date ...
0
votes
0answers
39 views

Procedure argument value change [duplicate]

I'm trying to create my own hamiltonian cycle algorithm using Mathematica for school, and I'm stuck on a syntax issue. I get the following error: ...
0
votes
0answers
43 views

Passing integration constants to self defined function

I would like to evaluate an integral I am taking in cylindrical coordinates, in which the integrand contains a previously defined function. I need to pass the r and phi integrand values to this ...
0
votes
3answers
38 views

Define a function of a vector without fully specifying the components of the vector [duplicate]

I have a vector $A=\{1,2,3,4,5,6\}$, and I want to define a function of $A$ as f[A_]:=A.X where $X$ is another vector. I want to define this function without ...
1
vote
2answers
59 views

How to make function accept list of rules as an argument?

Considering the list of rules: r= {"a" -> "1", "b" -> "2", "c" -> 3, d -> 231, "e" -> 1.25}; I want to have a function ...
0
votes
0answers
46 views

How to make Piecewise continuous [duplicate]

I have a function defined by its slope in a continuous sequence of intervals, e.g. ...
0
votes
1answer
67 views

Codes for the derivative of a random polynomials

Good day! Please, I need some help here, I used this codes ...
1
vote
3answers
133 views

Simplify a composition of functions

How do I make Mathematica simplify, for example, (1-#&)@*(1-#&) into #&? ...
1
vote
2answers
129 views

Minimizing the largest difference between two functions

I have two functions defined on the same domain, $f(x)$ and $g(x)$ where $x$ is in $(0,1)$: f[x_] := (-1 + x) Log[1 - x] - x Log[x] g[x_] := Log[1 + 2 (-1 + x) x] ...
2
votes
2answers
63 views

How to apply list of values to a list of functions

I have the following: first= {1+a,2+a,3+a,4+a} and a list t={0,1,2,3} I want to evaluate the first element of "first" at ...
1
vote
1answer
35 views

Calculate the partial vapor pressures of a variable at xB = 0.75 based on the interpolation functions of the data

I'm having troubles in solving an exercise for an assignment in my Chemistry course. Talking about interpolations, I've already have a graph but I need to:(c) Calculate the partial vapor pressures of ...
0
votes
3answers
82 views

Using Solve to obtain a constant so that f(x) is continuous at x=2

I need to solve for c such that the function is continuous at x=2. How do I do this automatically? I have expressions for ...
5
votes
1answer
67 views

Using a progress bar in a functional expression

If we have a procedural construct like a Do loop or Table, it is straightforward to make a progress bar to indicate the percent ...
1
vote
2answers
58 views

NotebookWrite in EvaluationBox forces Input CellStyle

There is a promissing new function EvaluationBox[] and a nice last example in documentation section for it: ...
0
votes
1answer
78 views

how to download using weather data function many proporties exactly.

how to download using weather data function many proporties exactly. Example WeatherData["WMO44292", "Humidity", "Pressure", "Temperature", \ {{2005, 1, 1, 0, 0}, {2015, 1, 1, 0, 0}}] .
1
vote
1answer
37 views

How to change time zone for all outputs? [closed]

How to change the time zone in Mathematica for all functions returning a date or time?