Wolfram Language
Wolfram Language
For Engineering Computation
Outline
Outline
Motivation
Motivation
Necessity of computation in modern research and teaching
Introductory Examples
Introductory Examples
Modeling a Mass-Spring System
Basic Data Analysis on Car Models
Intermediate Examples
Intermediate Examples
System Modeler Integration
Audio Processing
Advanced Examples
Advanced Examples
PDE Modeling in 3D
Control Systems
Motivation
Motivation
What Is Computation?
What Is Computation?
Computation ⊃ {Fluid Mechanics, PDEs & Finite Elements, Fourier Analysis, Kinematics, Control Systems, Model Analysis, Machine Learning, Reliability Analysis, Complex Systems, Vibrations, Wavelet Analysis, Statistics, Optimization, Computer Vision, Signal Processing, Heat Transfer, Integral Transforms, Random Processes, Vector Analysis…
Computation ⊃ {Fluid Mechanics, PDEs & Finite Elements, Fourier Analysis, Kinematics, Control Systems, Model Analysis, Machine Learning, Reliability Analysis, Complex Systems, Vibrations, Wavelet Analysis, Statistics, Optimization, Computer Vision, Signal Processing, Heat Transfer, Integral Transforms, Random Processes, Vector Analysis…
Introductory Examples
Introductory Examples
Modeling a Mass-Spring System
Modeling a Mass-Spring System
Define our parameters for a basic mass-spring system, with damping term :
b
m+b+kx0
′′
x
′
x
In[]:=
Clear[m1,b1,k1,x0,v0,x]m1=1;b1=;k1=5;x0=;v0=0;
1
5
7
2
Analytically solve the differential equation:
In[]:=
dampedSol=DSolveValue[{m1x''[t]+b1x'[t]+k1x[t]==0,x[0]==x0,x'[0]==v0},x[t],t]
Out[]=
7
998
-t/10
499
t10
499
Sin499
t10
In[]:=
x[t_]=dampedSol;Plot[x[t],{t,0,10},Frame->True,FrameLabel->{"Time","Displacement"}]
Out[]=
Compute some properties such as kinetic energy and potential energy:
In[]:=
kE[t_]:=m1pE[t_]:=k1tE[t_]:=kE[t]+pE[t]Plot[{kE[t],pE[t],tE[t]},{t,0,10},PlotLegends->"Expressions",PlotTheme->"Scientific",PlotRange->All]
1
2
2
x'[t]
1
2
2
x[t]
Create an interactive interface of the damped system:
Vary the driving frequency and look for resonance:
Obtain details on all variables for the formula:
Introductory Examples
Introductory Examples
Car Model Dataset
Car Model Dataset
Along with all the curated data from Wolfram|Alpha, Wolfram Language also has direct access to the Wolfram Data Repository. This is a public location where users can submit datasets that can then be used by others.
The repository is organized into categories for easy navigation.
Retrieve a curated dataset containing features of cars manufactured between 1970 and 1982 in the US, Europe and Japan:
Average mileage and displacement across all models for each year:
Tally per year and per country of origin:
We can even look at the distribution of number of cylinders per year and per country of origin:
Pivot the data to create columns of miles per gallon for each number of cylinders:
Plot horsepower against time to accelerate from 0 mph to 60 mph, with bubbles sized according to the mileage and colored according to the number of cylinders:
Intermediate Examples
Intermediate Examples
System Modeler Integration
System Modeler Integration
Wolfram System Modeler is a very general environment that handles modeling of systems with mechanical, electrical, thermal, chemical, biological and other components, as well as combinations of different types of components. It’s based—like Wolfram Language—on the very general idea of representing everything in symbolic form.
Obtain all built-in examples in the Modelica rotational mechanics library:
System Modeler integrates directly with the Wolfram Language technology stack:
Validating a Tank System
Validating a Tank System
Start with a model of a tank system and simulate it for 30 s:
Validate the requirement, “whenever the water level in the first tank is above 1.2 m, and for at least 6 s more, the water level in the second tank should be above 0.6 m”:
Show the failure plot:
The water level in the second tank goes below 0.6 m too early:
Each built-in example has a documentation page within System Modeler:
Intermediate Examples
Intermediate Examples
Audio Processing
Audio Processing
Consider the following audio clip of a man speaking:
We can speed up the audio while preserving the pitch:
Plot the original and contracted audio:
We can also shift every pitch by one octave:
Compute the max of the signal on each partition and display it on top of the waveform:
Compute the formants of the signal, which represent the distribution of frequencies filtered by the vocal tract, on each partition and display them on top of the spectrogram:
Compute the formants of the signal, which represent the distribution of frequencies filtered by the vocal tract, on each partition and display them on top of the spectrogram:
Simulate how the speech might change in a railway tunnel by creating a reverberation effect with an impulse response:
The recording environment can boost or attenuate certain frequencies, thus altering the formants. Compute and visualize the new formants:
File Formats
File Formats
What about other audio formats?
Advanced Examples
Advanced Examples
Solving PDEs over 3D Regions
Solving PDEs over 3D Regions
The displacement of a teaspoon as a force is applied to it can be modeled with partial differential equations.
Set up initial displacement variables and material parameters:
Set up our geometry:
Pay attention to the boundary conditions:
Plot the original spoon with its displaced counterpart:
Advanced Examples
Advanced Examples
Regulating Magnetic Levitation
Regulating Magnetic Levitation
Levitate a ball about an equilibrium point:
Define our equations:
A set of numerical values for the model parameters:
Without feedback, the ball falls down:
Set the input voltage as the sole feedback input:
Design a feedback controller to levitate the ball:
Obtain the closed-loop system:
The velocity of the ball and current of the electromagnet:
Obtain controller model:
The control effort:
Summary
Summary
Unified solution for engineering students, researchers and professionals
State-of-the-art symbolic and numerical computation
Access to real-world data
Powerful and immediate visualization tools
Next Steps
Next Steps
Become a Wolfram Language User
Become a Wolfram Language User
Start a free 15-day trial
Check if you have access through your organization here
Explore interactive courses on Wolfram U
References
References
See our Public Resources here
Engineering-specific guide
Finite Element Method Core Area page