symsofequation

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Symbolics tools
Introduced first in SolidGeometry 4.8, Creation date: 2019-11-11, Last change: 2025-09-14

returns or defines the symbols of a equation system

Description

if there is no output, the symbols are defined using evalin('caller',ev) in the calling workspace

See Also:

Example Illustration

 missing image of symsofequation(eq)

Syntax

[S,v,ev]=symsofequation([eq])

Input Parameter

eq: equation systems to analyze

Output Parameter

S: String of Symbols
v: cell list of Symbols
ev: evaluation string

Examples


symsofequation('U==R*I, P==U*I, W==P*t');




Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

The function symsofequation is designed to analyze a system of equations and identify the symbols used within them. It is part of the SYMBOLICS TOOLS class in the SG-Library.

Input Parameters

Output Results

Algorithm Steps

  1. The function begins by retrieving the equation system from the input parameters using getfuncparams. If no input is provided, it uses the default equation.
  2. It identifies the symbols in the equation using the symvar function, storing them in the variable v.
  3. An empty string S is initialized to accumulate the symbols.
  4. A loop iterates over each symbol in v, appending it to S with a space separator.
  5. The trailing space in S is removed using strtrim.
  6. The evaluation string ev is constructed using sprintf to format the syms command with the symbols in S.
  7. If no output arguments are specified, the function prints the evaluation string and executes it in the caller's workspace using evalin.

Example

Calling symsofequation('U==R*I, P==U*I, W==P*t') will identify the symbols U, R, I, P, W, and t, and construct the evaluation string 'syms U R I P W t'.

Algorithm explaination created using ChatGPT on 2025-08-18 23:38. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21