带函数的逆三角方程

带函数的逆三角方程

我正在尝试自动化报告,以便我能够更改顶部定义的变量,这些变量将通过更新的数字级联到文档中。

我的问题是尝试计算反三角函数,其中函数的参数实际上是另一个方程(见屏幕截图)。 (我认为 \def 只是一个字符串,当放入 tikz 时,它会被求值。)

在此处输入图片描述

有人可以帮助我吗:

  1. 将方程式(参数)求到另一个变量,以解析为单个数字,或者
  2. 描述如何正确地将方程嵌入反三角函数中,或者
  3. 有其他方法帮忙吗?

您会在下面的 MWE 中看到我想使用计算器包中的 \ARCSIN。有没有更好的选择?

谢谢

\documentclass{article}

\usepackage{calc}
\usepackage{calculator}
\usepackage{trig}

\begin{document}

%% Defined Variables
\def\CrankAngle{170} % Angle position of the crank for piston dynamics
\def\Stroke{60} % Piston stroke, which is equivalent to crank working diameter
\def\ConRodLength{100} % Length of connecting rod
\def\PistonOffset{25} % L_o - offset of the piston cylinder from the crank centerline

%% Derived Variables (Calculated from Defined Variables)
\CalculateCos{\CrankAngle} % Need to pre-calculate the value before using
\def\StrokeXPos{\UseCos{\CrankAngle}*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO

\CalculateSin{\CrankAngle} % Need to pre-calculate the value before using
\def\StrokeYPos{\UseSin{\CrankAngle}*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO

\def\ConRodYOffset{\PistonOffset -\StrokeYPos}

\def\ConRodSinRatio{\ConRodYOffset/\ConRodLength}

%\ARCSIN{\ConRodSinRatio}{\sol} - WHAT TO USE THIS (OR SIMILAR) BUT NEED NUMBER IN RATIO; NOT EXPRESSION


\section{Sample Evaluations}

X-Position = \StrokeXPos

Y-Position = \StrokeYPos

Con Rod Y-Offset = \ConRodYOffset

Con Rod Sin Ratio = \ConRodSinRatio

\end{document}

答案1

我一直用它pgf来计算,而且效果很好:

在此处输入图片描述

代码:

\documentclass{article}
\usepackage{mathtools}% For {align*}
\usepackage{pgf}

\begin{document}

%% Defined Variables
\def\CrankAngle{170} % Angle position of the crank for piston dynamics
\def\Stroke{60} % Piston stroke, which is equivalent to crank working diameter
\def\ConRodLength{100} % Length of connecting rod
\def\PistonOffset{25} % L_o - offset of the piston cylinder from the crank centerline

%% Derived Variables (Calculated from Defined Variables)
\pgfmathsetmacro\StrokeXPos{cos(\CrankAngle)*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO

\pgfmathsetmacro\StrokeYPos{sin(\CrankAngle)*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO

\pgfmathsetmacro\ConRodYOffset{\PistonOffset -\StrokeYPos}

\pgfmathsetmacro\ConRodSinRatio{\ConRodYOffset/\ConRodLength}

\pgfmathsetmacro\ArcSinValue{asin(\ConRodSinRatio)} 


\section{Sample Evaluations}

\begin{align*}
    \text{X-Position} &= \StrokeXPos \\
    \text{Y-Position} &= \StrokeYPos \\
    \text{Con Rod Y-Offset} &= \ConRodYOffset \\
    \text{Con Rod Sin Ratio} &= \ConRodSinRatio \\
    \text{Arc Sin Value} &= \ArcSinValue \\
\end{align*}

\end{document}

相关内容