Message Boards Message Boards


Differential Equations and Unit Notation

Posted 3 years ago
5 Replies
0 Total Likes

See attached file.

  1. What do I get the Syntax::sntxi: Incomplete expression; more input is needed . error when I try to use the math palette for derivatives?

  2. What does the dot in 10. Farad Micro Volt mean? Multiplication?

  3. Why is my C1 changed to C[1]? What does that mean? Basically I wanted to use C for capacitance but the letter C was protected

  4. How come my unit convert isn't working?

    In[80]:= R := 500 Ohm 
    C1 := 0.5 Micro Farad 
    V := 20 Volt
    DSolve[R*q1'[t] + 1/C1*q1[t] == V, q1[t], t]

    Out[83]= {{q1[t] -> 
       10. Farad Micro Volt + E^(-((0.004 t)/(Farad Micro Ohm))) C[1]}}

    In[92]:= TraditionalForm[R*q1'[t] + 1/C1*q1[t] == V]

    Out[92]//TraditionalForm= (2. q1(t))/(Farad Micro)+500 Ohm q1^\[Prime](t)==20 Volt

    In[89]:= R := 500 Ohm 
    C1 := 0.5 Micro Farad 
    V := 20 Volt
    DSolve[R*(\[DifferentialD]/\[DifferentialD]t)q1[t] + 1/C1*q1[t] == V, 
     q1[t], t]

    During evaluation of In[89]:= Syntax::sntxi: Incomplete expression; more input is needed .

    In[94]:= UnitConvert[
     10.` Farad Micro Volt + 
      E^(-((0.004` t)/(Farad Micro Ohm))) C[1], Coulomb]

    Out[94]= UnitConvert[
     10. Farad Micro Volt + 
      E^(-((0.004 t)/(Farad Micro Ohm))) C[1], Coulomb]
5 Replies
  • To do calculations with units, use Quantity expressions:

If you want to enter something representing "500 Ohms" you would write:

Quantity[500, " Ohm"]
  • Capitalized variable names are used for built in functions and values. Variables you create should start with a lower case letter. The variable C is used as a constant of integration by Mathematica in some of it's output.
  • It is good practice to use descriptive variable names when programming. When you do math on a chalkboard, it's fine to just "C" or "q1" as a variable name. In programming, this becomes a major problem. Try using descriptive variable names.

DSolve doesn't seem to be able to understand the equation with Units. You'll want to make sure the dimensions of your units are correct. It's possible though that DSolve just can't handle a differential equation with these units in them.

Posted 3 years ago

Even though he answered the question, I'd still love to hear anyone else's thoughts on the below

In particular, I won't be using Mathematica for coding- I'll be using it as a glorified calculator for PSETs in classes. I've noticed alot of people use the website heavily in classes for crunching calculations with units and solving diffeqs but ultimately it would be nice to be able to work with more than one line. I've noticed also when a new problem is written sometimes and the numbers end up a bit too messy for a TI 83 so the TA's writing the solution may use mathematica or maple to crunch some calculations. I've also noticed some students turning in typed solutions to PSET's

So being able to express things in ways my classmates can understand like 5 Ohms or 6 meters as opposed to R1=Quantity[,] is helpful

I'm looking for tips on making my Mathematica code to look as much like math done handwritten on paper as possible

Also does anyone know if Dsolve can handle units?

What's our best bet for equation solving with units if you want to make the work look as readable to non coders as possible?

You can enter Quantity expressions using Free-Form input. It's natural language, so it's very intuitive. See this tutorial:

Posted 3 years ago
  1. It looks like in the link you can use multiple orange = boxes in the same line. When I press = at the start of the line, the = is recognized as the orange =. How do I put multiple orange = in the same line as in this

  2. Can Dsolve handle units?

You can use the menu item Insert > Inline Free form Input (there is also a system-dependent keyboard shortcut).

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract