Mathjax

jsxgraph

Friday, October 18, 2024

WxMaxima for Statics

 A little customization of WxMaxima can make it much more useful for engineering calculations.  I like WxMaxima because of the interface and that it starts up fast.  For users of MATLAB and other engineering math software some things can be tedious.  I have an initialization file that adds a few very useful functions for Engineering.

Engineers use degrees instead of radians.  MATLAB has functions that simplify using degrees by appending a 'd' to the function name.  Engineers often use vector dot and cross products which are not intuitive in maxima.  Here is my WxMaxima startup file  which is located in  ~/.maxima/wxmaxima-init.mac which adds trigonometric and vector functions.


/* [wxMaxima: input   start ] */
sind(x) := float(sin(x*%pi/180));
cosd(x) := float(cos(x*%pi/180));
tand(x) := float(tan(x*%pi/180));
cotd(x) := float(tan(x*%pi/180));
secd(x) := float(tan(x*%pi/180));
cscd(x) := float(tan(x*%pi/180));


asind
(x) := float(180/%pi*asin(x));
acosd(x) := float(180/%pi*acos(x));
atand(x) := float(180/%pi*atan(x));
atan2d(y,x) := float(180/%pi*atan2(y,x));
asecd(x) := float(180/%pi*asin(x));
acscd(x) := float(180/%pi*asin(x));
acotd(x) := float(180/%pi*asin(x));

/* for dot(scalar) and cross(vector) vector products*/
load("vect");

dot(x,y) := x.y;
cross(x,y) := express(x~y);
/* [wxMaxima: input   end   ] */


I have similar commands for Python but need to add them at the start.  I don't know where the startup scripts would go for Jupyter and Spyder.

import numpy as np
from numpy import dot, cross

def sind(x):
    return np.sin(np.deg2rad(x));

def cosd(x):
    return np.cos(np.deg2rad(x));

def tand(x):
    return np.tan(np.deg2rad(x));

def secd(x):
    return np.sec(np.deg2rad(x));

def tand(x):
return np.csc(np.deg2rad(x));

def tand(x):
    return np.cot(np.deg2rad(x));

def acosd(x):
    return np.rad2deg(np.arccos(x));

def asind(x):
    return np.rad2deg(np.arcsin(x));

def atand(x):
    return np.rad2deg(np.arctan(x));

def atan2d(y,x):
    return np.rad2deg(np.arctan2(y,x));

def acscd(x):
    return np.rad2deg(np.arccos(x));

def asecd(x):
    return np.rad2deg(np.arcsin(x));

def acotd(x):
    return np.rad2deg(np.arctan(x));


No comments:

Post a Comment