2022-03-25 02:08:46 +00:00
|
|
|
---
|
2022-05-10 19:23:04 +00:00
|
|
|
sidebar_position: 1
|
2022-04-27 20:28:10 +00:00
|
|
|
title: Language Basics
|
2022-03-25 02:08:46 +00:00
|
|
|
---
|
|
|
|
|
2022-04-11 00:13:11 +00:00
|
|
|
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-04-28 14:58:39 +00:00
|
|
|
## Expressions
|
2022-04-27 18:49:15 +00:00
|
|
|
|
2022-05-03 21:22:08 +00:00
|
|
|
### Numbers
|
2022-04-27 18:49:15 +00:00
|
|
|
|
2022-06-27 07:07:09 +00:00
|
|
|
<SquiggleEditor defaultCode="4.32" />
|
2022-04-28 14:58:39 +00:00
|
|
|
|
2022-07-23 18:06:15 +00:00
|
|
|
### Distributions
|
|
|
|
|
|
|
|
<SquiggleEditor defaultCode={`a = normal(4,2)
|
|
|
|
b = 30 to 50
|
|
|
|
c = lognormal({mean:90, stdev: 7})
|
|
|
|
d = mixture(a,b,c, [0.3, 0.3, .4])
|
|
|
|
{a:a, b:b, c:c, d:d}`} />
|
|
|
|
|
|
|
|
### Lists
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-04-10 23:15:46 +00:00
|
|
|
<SquiggleEditor
|
2022-07-22 18:50:56 +00:00
|
|
|
defaultCode={`[beta(1,10), 4, isNormalized(SampleSet.fromDist(1 to 2))]`}
|
2022-04-10 23:15:46 +00:00
|
|
|
/>
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-07-23 18:06:15 +00:00
|
|
|
<SquiggleEditor
|
|
|
|
defaultCode={`List.make(5,1)`}
|
|
|
|
/>
|
|
|
|
|
|
|
|
### Dictionaries
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-04-28 15:21:10 +00:00
|
|
|
<SquiggleEditor
|
2022-06-27 07:07:09 +00:00
|
|
|
defaultCode={`d = {dist: triangular(0, 1, 2), weight: 0.25}
|
2022-04-28 15:21:10 +00:00
|
|
|
d.dist`}
|
|
|
|
/>
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-07-23 18:06:15 +00:00
|
|
|
### Functions
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-04-27 18:49:15 +00:00
|
|
|
<SquiggleEditor
|
2022-07-23 18:06:15 +00:00
|
|
|
defaultCode={`f(t) = normal(t^2, t^1.2+.01)
|
|
|
|
f`}
|
2022-04-27 18:49:15 +00:00
|
|
|
/>
|
|
|
|
|
2022-04-28 14:58:39 +00:00
|
|
|
|
2022-07-23 18:06:15 +00:00
|
|
|
### Anonymous Functions
|
2022-03-25 02:08:46 +00:00
|
|
|
|
2022-04-10 23:15:46 +00:00
|
|
|
<SquiggleEditor
|
2022-07-23 18:06:15 +00:00
|
|
|
defaultCode={`{|t| normal(t^2, t^1.2+.01)}`}
|
2022-04-10 23:15:46 +00:00
|
|
|
/>
|
2022-04-28 15:21:10 +00:00
|
|
|
|
|
|
|
## See more
|
|
|
|
|
2022-06-14 21:47:09 +00:00
|
|
|
- [Distribution creation](./DistributionCreation)
|
2022-05-20 15:50:53 +00:00
|
|
|
- [Functions reference](./Functions)
|
2022-05-20 15:46:10 +00:00
|
|
|
- [Gallery](../Discussions/Gallery)
|