Questions tagged [syntax]

Questions on the correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and _ characters, which are keyboard shortcuts for the Wolfram Language named functions Apply, Map, Slot, Function, and Blank.

Filter by
Sorted by
Tagged with
0 votes
0 answers
54 views

Adding text to a math cell in mathematica?

This might be a very basic question, but I'm a bit new to mathematica and seem to be unable to find a specific feature that i think probably exists. I want to add a small text annotation to one of my ...
user avatar
4 votes
2 answers
166 views

How to calculate different combinations of back and dotted perimeter

I have this code that generates the image below, my question is how to calculate the area and perimeter of the first figure and all the variations of it considering a side of square "L" or ...
user avatar
  • 43
1 vote
0 answers
36 views

Syntax error in entering mathematical expression [closed]

I am trying to enter the following mathematical expression in code: ...
user avatar
  • 11
1 vote
0 answers
41 views

What is the syntax for adding code, e.g. LinkWrite[...] to init.m? Version 12.0

I'm trying to use the suggestions for adding menu items discussed here: https://mathematica.stackexchange.com/a/909/44139 When I add ... ...
user avatar
0 votes
0 answers
29 views

Notation package problem [duplicate]

I am using Mathematica 12.3.1 on Windows 10. I am trying to load the Notation package: Needs["Notation`"] and I get the following: It seems the package ...
user avatar
  • 593
1 vote
2 answers
168 views

Express rational and infinite expressions in Mathematica [closed]

I have several doubts about notation. I would appreciate any clarifications. a) I can express, for example, a periodic or semi-periodic number without writing it in its rational form. Can such ...
user avatar
  • 480
1 vote
1 answer
91 views

How to get + ... notation at the end of a serie sum

$1+x+x^2+x^3+x^4+x^5+x^6+x^7+x^8+x^9+x^{10}+\text{...}$ Wanted output with extra + ... added to the series end This is the output from the series with using Normal <...
user avatar
  • 649
5 votes
2 answers
86 views

How to collect specified monomials in polynomial?

I'm not experienced in Wolfram Language, so couldn't you please help me with its syntax? Given the polynomial expression: ...
user avatar
27 votes
1 answer
912 views

When is ##@@@##& more appropriate than ##@@##&?

When assigning attachment operators, I often run into confusing statements like ##@@##&, ##@@@##&, or even ...
user avatar
  • 36.9k
2 votes
2 answers
161 views

How can I subtract and calculate the complement of a pair of sets? [closed]

I cannot properly implement these operations. How can I do it? This is a reduced example: A={2,3,4} B={2,4,6} C={1,2,3,4} Find ...
user avatar
  • 417
0 votes
0 answers
52 views

Non-standard Delay differential Equation

I am trying to solve the following system of ODEs: ...
user avatar
0 votes
0 answers
61 views

Codes that can solve $f'[a x]$

The usual Dsolve and NDSolve command are unable to sovle ODEs like ...
user avatar
0 votes
0 answers
35 views

Wait replacement before NIntegrate

To pose my question more concretely, let me consider the minimal example NIntegrate[1, {u, 0, a}] /. a -> 0.241 which gives as output: ...
user avatar
  • 347
1 vote
2 answers
61 views

How to simplify the following expression by collecting logs?

Consider the following function: ...
user avatar
  • 4,070
0 votes
0 answers
46 views

RegionMeasure works very slow for BooleanRegion

Consider two regions: ...
user avatar
  • 4,070
1 vote
1 answer
133 views

Mathematica failing to simplify ratio of pi-notation finite products

I'm wondering if the following behaviour could please be explained to me: ...
user avatar
4 votes
2 answers
239 views

What is the use of a list of replacement rules, when there are no curly braces around each one?

I've noticed the following in the Mathematica documentation for ReplaceAll: ...
user avatar
  • 333
0 votes
0 answers
37 views

How to change plot scaling depending on the coordinate?

Consider the following functions: f1[x_] = Exp[-(x/0.0003)^2]; f2[x_] = If[1.08 < x < 1.4, 0.003 Exp[-((x - 1.2)/0.2)^2], 0]; The first one, f1, is peaked at ...
user avatar
  • 4,070
1 vote
0 answers
41 views

How module checks if syntax is correct?

I would like to understand the following module subtlety. Consider two seemingly equivalent instances Module[{temp}, Sequence[x, x]] (Module::argrx: Module called ...
user avatar
  • 2,939
5 votes
2 answers
258 views

What is wrong with my Which command syntax?

Here is an example of my issue: condition=m>0; f[m_] = Which[condition == True, 1, condition == False, 2] f[-10] returns ...
user avatar
  • 635
0 votes
1 answer
42 views

Using the symbol of the system of equations [duplicate]

Part 1 I'd like to know how to use the symbol of system of equations (left curly braces). I tried the following code: Part 2 How can I add a third equation?
user avatar
0 votes
1 answer
115 views

Symbol of system of equations

I'm wondering if there is a way to use the symbol (the left curly bracket) of a system of equations. So far I found only the following "symbol": I need to remove the two conditions. EDIT2: ...
user avatar
0 votes
1 answer
60 views

Adding Assumptions in double integral written in "math input" mode

I've the following double integral and I'd like to write Assumptions->Re[c]>0, but if I try to do it, I get a syntax error. How can I add the above condition but without changing the ...
user avatar
1 vote
1 answer
88 views

Use symbol to replace function

I'm trying some transformations and they are getting complicated. It's common in physics to replace functions by symbols so you term get shorter. Lets say I have transformation ...
user avatar
  • 305
10 votes
2 answers
219 views

How to compile matrix product?

Consider the following matrices: ...
user avatar
  • 4,070
1 vote
0 answers
74 views

How to compile the following evaluation?

I have the following question. I want to generate three vectors p1Unrotated,p2Unrotated,p3Unrotated at some reference frame, then rotate them by some random angles $...
user avatar
  • 4,070
5 votes
1 answer
94 views

On the quotation mark around Method option in NDSolve

I note that in the documents about NDSolve or its variants, the main Method option has no quotation mark while its sub-...
user avatar
  • 723
1 vote
0 answers
22 views

Assumptions when maximizing a function

I'm trying to solve this (rather basic) maximization problem using Mathematica: $$ \left\{ \begin{aligned} \sqrt2 s &= 2d\\ r^2 &= x^2+d^2\\ h(x) &= r+x\\ A(x) &= s^2\\ V(x) &= \...
user avatar
  • 1,231
1 vote
0 answers
54 views

A question about generating table [closed]

Consider a vector that is generated somehow, say vec:={RandomReal[{0,2}],RandomReal[{0,1}],RandomReal[{2,3}]}; Note that it is evaluated on-flight, I cannot ...
user avatar
  • 4,070
8 votes
1 answer
270 views

How to compute RandomReal faster?

I have variables $E_{1},E_{3}$ that are bounded in the following way: $$ \tag 1 E_{1}>m_{1}, \quad E_{3}>m_{3}, E_{2}\equiv m-E_{1}-E_{3}>m_{2}, \\ -1 < \frac{E_{2}^{2}-m_{2}^{2}-(E_{1}^{2}...
user avatar
  • 4,070
1 vote
1 answer
79 views

A very basic question about weighted data

I have a dataset in the form {{A1,B1,C1,...},{A2,B2,C2,...},...} and the weights in the form {w1,w2,w3,...} Having this ...
user avatar
  • 4,070
5 votes
1 answer
139 views

What Does this Syntax Mean in Ouput from DSolve?

When I run the code DSolve[y*D[f[x, y, z], z] - z*D[f[x, y, z], y] == 0, f[x, y, z], {x, y, z}] I get the following output. I don't understand this syntax. I ...
user avatar
1 vote
1 answer
143 views

Expression cannot begin with "$\sum_{j=0}^{\floor*\frac{a}{b}} j$"

This is my first time using Wolfram Mathematica and writing in TeX. I'm on the free trial version of Mathematica, and I'm writing in a notebook, using the "Inline TeX Input" option on the &...
user avatar
1 vote
1 answer
79 views

Single-press TemplateBox deletion

One of the handy things about TemplateBox is that it can be used to define an alias for a more "natural symbol" (by having an empty list first argument ...
user avatar
1 vote
0 answers
50 views

What does the Q stand for in some built-in symbols? [closed]

What is the "Q" in built-in symbols such as FreeQ[expr, form], MemberQ[list, form]? (Query?) Thanks.
user avatar
9 votes
1 answer
265 views

How to visualize overtones in Mathematica?

I would like to visualize the difference in sounds extracted by different musical instruments, which is due to different overtones. In order to do this, I define the following samples: ...
user avatar
  • 4,070
0 votes
1 answer
41 views

Trigonometric simplification .Correct syntax? [closed]

I cannot simplify this expression any further, which should result in 7. Could you please provide me with the correct syntax, I have tried several without success. $$Assumptions[A + B + C == 0 , ...
user avatar
  • 480
2 votes
1 answer
114 views

Coloring all the variables with the same name with the same color

I would like to know if there is a possibility to automatically color the variables with the same name with the same color. For example, like in the picture below: Right now I need to do it manually ...
user avatar
1 vote
1 answer
108 views

How to express number in exponential decimal such as 1e2=100?

I am using MATLAB for a long time, and usually I express the number as exponential decimal such as x = 1e2; % x=100 However, if I write this form in mathematica, ...
user avatar
  • 13
0 votes
1 answer
60 views

How to make the following plot

Consider the following dataset: tab1 = Table[{i, i^2, 0.8*i^(3/2), i^4}, {i, 1, 10, 1}] Is it possible to make a plot similar to the one shown below (where there ...
user avatar
  • 4,070
1 vote
1 answer
60 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 ...
user avatar
  • 2,165
5 votes
1 answer
147 views

Incorrect syntax highlighting? "Variables made special by use in arguments" not working

This example is obviously not useful on its own, but it will cover everything I actually need to know for a more complicated function I'm making. The example is to recreate the ...
user avatar
  • 558
3 votes
0 answers
62 views

Cheatsheet for the use of special characters syntax

My favorite mass-use of special characters is if I have an expression that is linear in all variables (call the variable list $L$) and it must be identical zero. Then I generate my equation system ...
user avatar
5 votes
3 answers
256 views

Simplify/Expand equation so that right side equals 0

Given an equation like $$x^2 + (x + 82)^2 = (x + 100)^2,$$ how do I type to make this into $$x^2-36x-3276=0\; ?\tag{1}$$ This almost does it ...
user avatar
  • 1,231
0 votes
2 answers
65 views

How to create an operator which is a composition of a sequence of operators?

Suppose I have a sequence of operators $\partial_x$, $\partial_x^2$,..., $\partial_x^n$. I want to define an operator which is a composition of these $D_x^{(n)}=\partial_x\circ\partial_x^2\circ\cdot\...
user avatar
5 votes
3 answers
366 views

Evaluate equation for multiple values

This works fine; ((x - Sqrt[x])/(x + Sqrt[x]) - (x^2 - x)/36) /. x -> {1, 4, 8} but this does not ...
user avatar
  • 1,231
0 votes
1 answer
45 views

Resizing the graph of a function with radicals , Why?

I am trying to graph this function $c(t)=\frac{2-\sqrt{t+3}}{1-t}$ using this code, to see its behavior at infinity. I need that in the vertical axis appears the value when $t->1$ (The graphs ...
user avatar
3 votes
3 answers
192 views

Filtering and Averaging

I have a large 3D matrix (Length = 300k) with duplicated values list={{1,1,a},{1,1,b},{1,2,c},{1,2,d},{1,3,e}...} If the first and second elements exactly match ...
user avatar
  • 3,862
9 votes
2 answers
3k views

Is there a short way of writing (x==a || x==b || x==c)?

Something like x == (a|b|c) but that doesn't work.
user avatar
  • 91
2 votes
0 answers
172 views

Input subscripts in Wolfram Cloud

I would like to input "rendered" subscripts in Wolfram Cloud, without having to verbosely type Subscript[a, b]. The local notebook shortcut is ...
user avatar

1
2 3 4 5
18