Jump to content

Recommended Posts

Posted

I'm trying to write an article on my web site about special relativity.

Does HTML5 provide a way to render one over the square root of an expression on a web page?  The expression has superscripts and subscripts, which I know how to do.

Thank you for your help.

 

Jim Adrian

Posted

See if you can use this:

	<script>
	const recpSqrt = (value) => { return 1/(Math.sqrt(value)); }
	var v = 2; alert('Value: '+v+'\nSqrt: '+Math.sqrt(v)+'\nRecpSqrt: '+recpSqrt(v));
    v = 3; alert('Value: '+v+'\nSqrt: '+Math.sqrt(v)+'\nRecpSqrt: '+recpSqrt(v));
    v = 4; alert('Value: '+v+'\nSqrt: '+Math.sqrt(v)+'\nRecpSqrt: '+recpSqrt(v));
    v = 5; alert('Value: '+v+'\nSqrt: '+Math.sqrt(v)+'\nRecpSqrt: '+recpSqrt(v));
	</script>
	

 

Posted

Wikipedia and other sources use images to represent mathematical expressions on a page. HTML is not well equipped to represent them.

There is an XML-based language called MathML, but it is not well supported by browsers.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...